
obj/user/num.debug:     file format elf32-i386


Disassembly of section .text:

00800020 <_start>:
// starts us running when we are initially loaded into a new environment.
.text
.globl _start
_start:
	// See if we were started with arguments on the stack
	cmpl $USTACKTOP, %esp
  800020:	81 fc 00 e0 bf ee    	cmp    $0xeebfe000,%esp
	jne args_exist
  800026:	75 04                	jne    80002c <args_exist>

	// If not, push dummy argc/argv arguments.
	// This happens when we are loaded by the kernel,
	// because the kernel does not know about passing arguments.
	pushl $0
  800028:	6a 00                	push   $0x0
	pushl $0
  80002a:	6a 00                	push   $0x0

0080002c <args_exist>:

args_exist:
	call libmain
  80002c:	e8 58 01 00 00       	call   800189 <libmain>
1:	jmp 1b
  800031:	eb fe                	jmp    800031 <args_exist+0x5>

00800033 <num>:
int bol = 1;
int line = 0;

void
num(int f, const char *s)
{
  800033:	f3 0f 1e fb          	endbr32 
  800037:	55                   	push   %ebp
  800038:	89 e5                	mov    %esp,%ebp
  80003a:	56                   	push   %esi
  80003b:	53                   	push   %ebx
  80003c:	83 ec 10             	sub    $0x10,%esp
  80003f:	8b 75 08             	mov    0x8(%ebp),%esi
	long n;
	int r;
	char c;

	while ((n = read(f, &c, 1)) > 0) {
  800042:	8d 5d f7             	lea    -0x9(%ebp),%ebx
  800045:	eb 43                	jmp    80008a <num+0x57>
		if (bol) {
			printf("%5d ", ++line);
  800047:	a1 00 40 80 00       	mov    0x804000,%eax
  80004c:	83 c0 01             	add    $0x1,%eax
  80004f:	a3 00 40 80 00       	mov    %eax,0x804000
  800054:	83 ec 08             	sub    $0x8,%esp
  800057:	50                   	push   %eax
  800058:	68 40 21 80 00       	push   $0x802140
  80005d:	e8 00 18 00 00       	call   801862 <printf>
			bol = 0;
  800062:	c7 05 00 30 80 00 00 	movl   $0x0,0x803000
  800069:	00 00 00 
  80006c:	83 c4 10             	add    $0x10,%esp
		}
		if ((r = write(1, &c, 1)) != 1)
  80006f:	83 ec 04             	sub    $0x4,%esp
  800072:	6a 01                	push   $0x1
  800074:	53                   	push   %ebx
  800075:	6a 01                	push   $0x1
  800077:	e8 70 12 00 00       	call   8012ec <write>
  80007c:	83 c4 10             	add    $0x10,%esp
  80007f:	83 f8 01             	cmp    $0x1,%eax
  800082:	75 24                	jne    8000a8 <num+0x75>
			panic("write error copying %s: %e", s, r);
		if (c == '\n')
  800084:	80 7d f7 0a          	cmpb   $0xa,-0x9(%ebp)
  800088:	74 36                	je     8000c0 <num+0x8d>
	while ((n = read(f, &c, 1)) > 0) {
  80008a:	83 ec 04             	sub    $0x4,%esp
  80008d:	6a 01                	push   $0x1
  80008f:	53                   	push   %ebx
  800090:	56                   	push   %esi
  800091:	e8 80 11 00 00       	call   801216 <read>
  800096:	83 c4 10             	add    $0x10,%esp
  800099:	85 c0                	test   %eax,%eax
  80009b:	7e 2f                	jle    8000cc <num+0x99>
		if (bol) {
  80009d:	83 3d 00 30 80 00 00 	cmpl   $0x0,0x803000
  8000a4:	74 c9                	je     80006f <num+0x3c>
  8000a6:	eb 9f                	jmp    800047 <num+0x14>
			panic("write error copying %s: %e", s, r);
  8000a8:	83 ec 0c             	sub    $0xc,%esp
  8000ab:	50                   	push   %eax
  8000ac:	ff 75 0c             	pushl  0xc(%ebp)
  8000af:	68 45 21 80 00       	push   $0x802145
  8000b4:	6a 13                	push   $0x13
  8000b6:	68 60 21 80 00       	push   $0x802160
  8000bb:	e8 3b 01 00 00       	call   8001fb <_panic>
			bol = 1;
  8000c0:	c7 05 00 30 80 00 01 	movl   $0x1,0x803000
  8000c7:	00 00 00 
  8000ca:	eb be                	jmp    80008a <num+0x57>
	}
	if (n < 0)
  8000cc:	78 07                	js     8000d5 <num+0xa2>
		panic("error reading %s: %e", s, n);
}
  8000ce:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8000d1:	5b                   	pop    %ebx
  8000d2:	5e                   	pop    %esi
  8000d3:	5d                   	pop    %ebp
  8000d4:	c3                   	ret    
		panic("error reading %s: %e", s, n);
  8000d5:	83 ec 0c             	sub    $0xc,%esp
  8000d8:	50                   	push   %eax
  8000d9:	ff 75 0c             	pushl  0xc(%ebp)
  8000dc:	68 6b 21 80 00       	push   $0x80216b
  8000e1:	6a 18                	push   $0x18
  8000e3:	68 60 21 80 00       	push   $0x802160
  8000e8:	e8 0e 01 00 00       	call   8001fb <_panic>

008000ed <umain>:

void
umain(int argc, char **argv)
{
  8000ed:	f3 0f 1e fb          	endbr32 
  8000f1:	55                   	push   %ebp
  8000f2:	89 e5                	mov    %esp,%ebp
  8000f4:	57                   	push   %edi
  8000f5:	56                   	push   %esi
  8000f6:	53                   	push   %ebx
  8000f7:	83 ec 1c             	sub    $0x1c,%esp
	int f, i;

	binaryname = "num";
  8000fa:	c7 05 04 30 80 00 80 	movl   $0x802180,0x803004
  800101:	21 80 00 
	if (argc == 1)
  800104:	83 7d 08 01          	cmpl   $0x1,0x8(%ebp)
  800108:	74 46                	je     800150 <umain+0x63>
  80010a:	8b 45 0c             	mov    0xc(%ebp),%eax
  80010d:	8d 70 04             	lea    0x4(%eax),%esi
		num(0, "<stdin>");
	else
		for (i = 1; i < argc; i++) {
  800110:	bf 01 00 00 00       	mov    $0x1,%edi
  800115:	3b 7d 08             	cmp    0x8(%ebp),%edi
  800118:	7d 48                	jge    800162 <umain+0x75>
			f = open(argv[i], O_RDONLY);
  80011a:	89 75 e4             	mov    %esi,-0x1c(%ebp)
  80011d:	83 ec 08             	sub    $0x8,%esp
  800120:	6a 00                	push   $0x0
  800122:	ff 36                	pushl  (%esi)
  800124:	e8 82 15 00 00       	call   8016ab <open>
  800129:	89 c3                	mov    %eax,%ebx
			if (f < 0)
  80012b:	83 c4 10             	add    $0x10,%esp
  80012e:	85 c0                	test   %eax,%eax
  800130:	78 3d                	js     80016f <umain+0x82>
				panic("can't open %s: %e", argv[i], f);
			else {
				num(f, argv[i]);
  800132:	83 ec 08             	sub    $0x8,%esp
  800135:	ff 36                	pushl  (%esi)
  800137:	50                   	push   %eax
  800138:	e8 f6 fe ff ff       	call   800033 <num>
				close(f);
  80013d:	89 1c 24             	mov    %ebx,(%esp)
  800140:	e8 87 0f 00 00       	call   8010cc <close>
		for (i = 1; i < argc; i++) {
  800145:	83 c7 01             	add    $0x1,%edi
  800148:	83 c6 04             	add    $0x4,%esi
  80014b:	83 c4 10             	add    $0x10,%esp
  80014e:	eb c5                	jmp    800115 <umain+0x28>
		num(0, "<stdin>");
  800150:	83 ec 08             	sub    $0x8,%esp
  800153:	68 84 21 80 00       	push   $0x802184
  800158:	6a 00                	push   $0x0
  80015a:	e8 d4 fe ff ff       	call   800033 <num>
  80015f:	83 c4 10             	add    $0x10,%esp
			}
		}
	exit();
  800162:	e8 76 00 00 00       	call   8001dd <exit>
}
  800167:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80016a:	5b                   	pop    %ebx
  80016b:	5e                   	pop    %esi
  80016c:	5f                   	pop    %edi
  80016d:	5d                   	pop    %ebp
  80016e:	c3                   	ret    
				panic("can't open %s: %e", argv[i], f);
  80016f:	83 ec 0c             	sub    $0xc,%esp
  800172:	50                   	push   %eax
  800173:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  800176:	ff 30                	pushl  (%eax)
  800178:	68 8c 21 80 00       	push   $0x80218c
  80017d:	6a 27                	push   $0x27
  80017f:	68 60 21 80 00       	push   $0x802160
  800184:	e8 72 00 00 00       	call   8001fb <_panic>

00800189 <libmain>:
const volatile struct Env *thisenv;
const char *binaryname = "<unknown>";

void
libmain(int argc, char **argv)
{
  800189:	f3 0f 1e fb          	endbr32 
  80018d:	55                   	push   %ebp
  80018e:	89 e5                	mov    %esp,%ebp
  800190:	56                   	push   %esi
  800191:	53                   	push   %ebx
  800192:	8b 5d 08             	mov    0x8(%ebp),%ebx
  800195:	8b 75 0c             	mov    0xc(%ebp),%esi
	;    //系统调用，我们已经在Exercise 7中实现了
	
	
	
	//屏幕上打印出来了字母，但后续报错了，有意思，让我看看问题出现在哪。
	thisenv=0;
  800198:	c7 05 08 40 80 00 00 	movl   $0x0,0x804008
  80019f:	00 00 00 
	thisenv = &envs[ENVX(sys_getenvid())];      //获取Env结构指针
  8001a2:	e8 10 0b 00 00       	call   800cb7 <sys_getenvid>
  8001a7:	25 ff 03 00 00       	and    $0x3ff,%eax
  8001ac:	6b c0 7c             	imul   $0x7c,%eax,%eax
  8001af:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  8001b4:	a3 08 40 80 00       	mov    %eax,0x804008

	// save the name of the program so that panic() can use it
	if (argc > 0)
  8001b9:	85 db                	test   %ebx,%ebx
  8001bb:	7e 07                	jle    8001c4 <libmain+0x3b>
		binaryname = argv[0];
  8001bd:	8b 06                	mov    (%esi),%eax
  8001bf:	a3 04 30 80 00       	mov    %eax,0x803004

	// call user main routine
	umain(argc, argv);
  8001c4:	83 ec 08             	sub    $0x8,%esp
  8001c7:	56                   	push   %esi
  8001c8:	53                   	push   %ebx
  8001c9:	e8 1f ff ff ff       	call   8000ed <umain>

	// exit gracefully
	exit();
  8001ce:	e8 0a 00 00 00       	call   8001dd <exit>
}
  8001d3:	83 c4 10             	add    $0x10,%esp
  8001d6:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8001d9:	5b                   	pop    %ebx
  8001da:	5e                   	pop    %esi
  8001db:	5d                   	pop    %ebp
  8001dc:	c3                   	ret    

008001dd <exit>:

#include <inc/lib.h>

void
exit(void)
{
  8001dd:	f3 0f 1e fb          	endbr32 
  8001e1:	55                   	push   %ebp
  8001e2:	89 e5                	mov    %esp,%ebp
  8001e4:	83 ec 08             	sub    $0x8,%esp
	close_all();
  8001e7:	e8 11 0f 00 00       	call   8010fd <close_all>
	sys_env_destroy(0);
  8001ec:	83 ec 0c             	sub    $0xc,%esp
  8001ef:	6a 00                	push   $0x0
  8001f1:	e8 7c 0a 00 00       	call   800c72 <sys_env_destroy>
}
  8001f6:	83 c4 10             	add    $0x10,%esp
  8001f9:	c9                   	leave  
  8001fa:	c3                   	ret    

008001fb <_panic>:
 * It prints "panic: <message>", then causes a breakpoint exception,
 * which causes JOS to enter the JOS kernel monitor.
 */
void
_panic(const char *file, int line, const char *fmt, ...)
{
  8001fb:	f3 0f 1e fb          	endbr32 
  8001ff:	55                   	push   %ebp
  800200:	89 e5                	mov    %esp,%ebp
  800202:	56                   	push   %esi
  800203:	53                   	push   %ebx
	va_list ap;

	va_start(ap, fmt);
  800204:	8d 5d 14             	lea    0x14(%ebp),%ebx

	// Print the panic message
	cprintf("[%08x] user panic in %s at %s:%d: ",
  800207:	8b 35 04 30 80 00    	mov    0x803004,%esi
  80020d:	e8 a5 0a 00 00       	call   800cb7 <sys_getenvid>
  800212:	83 ec 0c             	sub    $0xc,%esp
  800215:	ff 75 0c             	pushl  0xc(%ebp)
  800218:	ff 75 08             	pushl  0x8(%ebp)
  80021b:	56                   	push   %esi
  80021c:	50                   	push   %eax
  80021d:	68 a8 21 80 00       	push   $0x8021a8
  800222:	e8 bb 00 00 00       	call   8002e2 <cprintf>
		sys_getenvid(), binaryname, file, line);
	vcprintf(fmt, ap);
  800227:	83 c4 18             	add    $0x18,%esp
  80022a:	53                   	push   %ebx
  80022b:	ff 75 10             	pushl  0x10(%ebp)
  80022e:	e8 5a 00 00 00       	call   80028d <vcprintf>
	cprintf("\n");
  800233:	c7 04 24 c3 25 80 00 	movl   $0x8025c3,(%esp)
  80023a:	e8 a3 00 00 00       	call   8002e2 <cprintf>
  80023f:	83 c4 10             	add    $0x10,%esp

	// Cause a breakpoint exception
	while (1)
		asm volatile("int3");
  800242:	cc                   	int3   
  800243:	eb fd                	jmp    800242 <_panic+0x47>

00800245 <putch>:
};


static void
putch(int ch, struct printbuf *b)
{
  800245:	f3 0f 1e fb          	endbr32 
  800249:	55                   	push   %ebp
  80024a:	89 e5                	mov    %esp,%ebp
  80024c:	53                   	push   %ebx
  80024d:	83 ec 04             	sub    $0x4,%esp
  800250:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	b->buf[b->idx++] = ch;
  800253:	8b 13                	mov    (%ebx),%edx
  800255:	8d 42 01             	lea    0x1(%edx),%eax
  800258:	89 03                	mov    %eax,(%ebx)
  80025a:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80025d:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
	if (b->idx == 256-1) {
  800261:	3d ff 00 00 00       	cmp    $0xff,%eax
  800266:	74 09                	je     800271 <putch+0x2c>
		sys_cputs(b->buf, b->idx);
		b->idx = 0;
	}
	b->cnt++;
  800268:	83 43 04 01          	addl   $0x1,0x4(%ebx)
}
  80026c:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80026f:	c9                   	leave  
  800270:	c3                   	ret    
		sys_cputs(b->buf, b->idx);
  800271:	83 ec 08             	sub    $0x8,%esp
  800274:	68 ff 00 00 00       	push   $0xff
  800279:	8d 43 08             	lea    0x8(%ebx),%eax
  80027c:	50                   	push   %eax
  80027d:	e8 ab 09 00 00       	call   800c2d <sys_cputs>
		b->idx = 0;
  800282:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  800288:	83 c4 10             	add    $0x10,%esp
  80028b:	eb db                	jmp    800268 <putch+0x23>

0080028d <vcprintf>:

int
vcprintf(const char *fmt, va_list ap)
{
  80028d:	f3 0f 1e fb          	endbr32 
  800291:	55                   	push   %ebp
  800292:	89 e5                	mov    %esp,%ebp
  800294:	81 ec 18 01 00 00    	sub    $0x118,%esp
	struct printbuf b;

	b.idx = 0;
  80029a:	c7 85 f0 fe ff ff 00 	movl   $0x0,-0x110(%ebp)
  8002a1:	00 00 00 
	b.cnt = 0;
  8002a4:	c7 85 f4 fe ff ff 00 	movl   $0x0,-0x10c(%ebp)
  8002ab:	00 00 00 
	vprintfmt((void*)putch, &b, fmt, ap);
  8002ae:	ff 75 0c             	pushl  0xc(%ebp)
  8002b1:	ff 75 08             	pushl  0x8(%ebp)
  8002b4:	8d 85 f0 fe ff ff    	lea    -0x110(%ebp),%eax
  8002ba:	50                   	push   %eax
  8002bb:	68 45 02 80 00       	push   $0x800245
  8002c0:	e8 20 01 00 00       	call   8003e5 <vprintfmt>
	sys_cputs(b.buf, b.idx);
  8002c5:	83 c4 08             	add    $0x8,%esp
  8002c8:	ff b5 f0 fe ff ff    	pushl  -0x110(%ebp)
  8002ce:	8d 85 f8 fe ff ff    	lea    -0x108(%ebp),%eax
  8002d4:	50                   	push   %eax
  8002d5:	e8 53 09 00 00       	call   800c2d <sys_cputs>

	return b.cnt;
}
  8002da:	8b 85 f4 fe ff ff    	mov    -0x10c(%ebp),%eax
  8002e0:	c9                   	leave  
  8002e1:	c3                   	ret    

008002e2 <cprintf>:

int
cprintf(const char *fmt, ...)
{
  8002e2:	f3 0f 1e fb          	endbr32 
  8002e6:	55                   	push   %ebp
  8002e7:	89 e5                	mov    %esp,%ebp
  8002e9:	83 ec 10             	sub    $0x10,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
  8002ec:	8d 45 0c             	lea    0xc(%ebp),%eax
	cnt = vcprintf(fmt, ap);
  8002ef:	50                   	push   %eax
  8002f0:	ff 75 08             	pushl  0x8(%ebp)
  8002f3:	e8 95 ff ff ff       	call   80028d <vcprintf>
	va_end(ap);

	return cnt;
}
  8002f8:	c9                   	leave  
  8002f9:	c3                   	ret    

008002fa <printnum>:
 * using specified putch function and associated pointer putdat.
 */
static void
printnum(void (*putch)(int, void*), void *putdat,
	 unsigned long long num, unsigned base, int width, int padc)
{
  8002fa:	55                   	push   %ebp
  8002fb:	89 e5                	mov    %esp,%ebp
  8002fd:	57                   	push   %edi
  8002fe:	56                   	push   %esi
  8002ff:	53                   	push   %ebx
  800300:	83 ec 1c             	sub    $0x1c,%esp
  800303:	89 c7                	mov    %eax,%edi
  800305:	89 d6                	mov    %edx,%esi
  800307:	8b 45 08             	mov    0x8(%ebp),%eax
  80030a:	8b 55 0c             	mov    0xc(%ebp),%edx
  80030d:	89 d1                	mov    %edx,%ecx
  80030f:	89 c2                	mov    %eax,%edx
  800311:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800314:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  800317:	8b 45 10             	mov    0x10(%ebp),%eax
  80031a:	8b 5d 14             	mov    0x14(%ebp),%ebx
	// first recursively print all preceding (more significant) digits
	if (num >= base) {
  80031d:	89 45 e0             	mov    %eax,-0x20(%ebp)
  800320:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
  800327:	39 c2                	cmp    %eax,%edx
  800329:	1b 4d e4             	sbb    -0x1c(%ebp),%ecx
  80032c:	72 3e                	jb     80036c <printnum+0x72>
		printnum(putch, putdat, num / base, base, width - 1, padc);
  80032e:	83 ec 0c             	sub    $0xc,%esp
  800331:	ff 75 18             	pushl  0x18(%ebp)
  800334:	83 eb 01             	sub    $0x1,%ebx
  800337:	53                   	push   %ebx
  800338:	50                   	push   %eax
  800339:	83 ec 08             	sub    $0x8,%esp
  80033c:	ff 75 e4             	pushl  -0x1c(%ebp)
  80033f:	ff 75 e0             	pushl  -0x20(%ebp)
  800342:	ff 75 dc             	pushl  -0x24(%ebp)
  800345:	ff 75 d8             	pushl  -0x28(%ebp)
  800348:	e8 83 1b 00 00       	call   801ed0 <__udivdi3>
  80034d:	83 c4 18             	add    $0x18,%esp
  800350:	52                   	push   %edx
  800351:	50                   	push   %eax
  800352:	89 f2                	mov    %esi,%edx
  800354:	89 f8                	mov    %edi,%eax
  800356:	e8 9f ff ff ff       	call   8002fa <printnum>
  80035b:	83 c4 20             	add    $0x20,%esp
  80035e:	eb 13                	jmp    800373 <printnum+0x79>
	} else {
		// print any needed pad characters before first digit
		while (--width > 0)
			putch(padc, putdat);
  800360:	83 ec 08             	sub    $0x8,%esp
  800363:	56                   	push   %esi
  800364:	ff 75 18             	pushl  0x18(%ebp)
  800367:	ff d7                	call   *%edi
  800369:	83 c4 10             	add    $0x10,%esp
		while (--width > 0)
  80036c:	83 eb 01             	sub    $0x1,%ebx
  80036f:	85 db                	test   %ebx,%ebx
  800371:	7f ed                	jg     800360 <printnum+0x66>
	}

	// then print this (the least significant) digit
	putch("0123456789abcdef"[num % base], putdat);
  800373:	83 ec 08             	sub    $0x8,%esp
  800376:	56                   	push   %esi
  800377:	83 ec 04             	sub    $0x4,%esp
  80037a:	ff 75 e4             	pushl  -0x1c(%ebp)
  80037d:	ff 75 e0             	pushl  -0x20(%ebp)
  800380:	ff 75 dc             	pushl  -0x24(%ebp)
  800383:	ff 75 d8             	pushl  -0x28(%ebp)
  800386:	e8 55 1c 00 00       	call   801fe0 <__umoddi3>
  80038b:	83 c4 14             	add    $0x14,%esp
  80038e:	0f be 80 cb 21 80 00 	movsbl 0x8021cb(%eax),%eax
  800395:	50                   	push   %eax
  800396:	ff d7                	call   *%edi
}
  800398:	83 c4 10             	add    $0x10,%esp
  80039b:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80039e:	5b                   	pop    %ebx
  80039f:	5e                   	pop    %esi
  8003a0:	5f                   	pop    %edi
  8003a1:	5d                   	pop    %ebp
  8003a2:	c3                   	ret    

008003a3 <sprintputch>:
	int cnt;
};

static void
sprintputch(int ch, struct sprintbuf *b)
{
  8003a3:	f3 0f 1e fb          	endbr32 
  8003a7:	55                   	push   %ebp
  8003a8:	89 e5                	mov    %esp,%ebp
  8003aa:	8b 45 0c             	mov    0xc(%ebp),%eax
	b->cnt++;
  8003ad:	83 40 08 01          	addl   $0x1,0x8(%eax)
	if (b->buf < b->ebuf)
  8003b1:	8b 10                	mov    (%eax),%edx
  8003b3:	3b 50 04             	cmp    0x4(%eax),%edx
  8003b6:	73 0a                	jae    8003c2 <sprintputch+0x1f>
		*b->buf++ = ch;
  8003b8:	8d 4a 01             	lea    0x1(%edx),%ecx
  8003bb:	89 08                	mov    %ecx,(%eax)
  8003bd:	8b 45 08             	mov    0x8(%ebp),%eax
  8003c0:	88 02                	mov    %al,(%edx)
}
  8003c2:	5d                   	pop    %ebp
  8003c3:	c3                   	ret    

008003c4 <printfmt>:
{
  8003c4:	f3 0f 1e fb          	endbr32 
  8003c8:	55                   	push   %ebp
  8003c9:	89 e5                	mov    %esp,%ebp
  8003cb:	83 ec 08             	sub    $0x8,%esp
	va_start(ap, fmt);
  8003ce:	8d 45 14             	lea    0x14(%ebp),%eax
	vprintfmt(putch, putdat, fmt, ap);
  8003d1:	50                   	push   %eax
  8003d2:	ff 75 10             	pushl  0x10(%ebp)
  8003d5:	ff 75 0c             	pushl  0xc(%ebp)
  8003d8:	ff 75 08             	pushl  0x8(%ebp)
  8003db:	e8 05 00 00 00       	call   8003e5 <vprintfmt>
}
  8003e0:	83 c4 10             	add    $0x10,%esp
  8003e3:	c9                   	leave  
  8003e4:	c3                   	ret    

008003e5 <vprintfmt>:
{
  8003e5:	f3 0f 1e fb          	endbr32 
  8003e9:	55                   	push   %ebp
  8003ea:	89 e5                	mov    %esp,%ebp
  8003ec:	57                   	push   %edi
  8003ed:	56                   	push   %esi
  8003ee:	53                   	push   %ebx
  8003ef:	83 ec 3c             	sub    $0x3c,%esp
  8003f2:	8b 75 08             	mov    0x8(%ebp),%esi
  8003f5:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  8003f8:	8b 7d 10             	mov    0x10(%ebp),%edi
  8003fb:	e9 5d 03 00 00       	jmp    80075d <vprintfmt+0x378>
		padc = ' ';
  800400:	c6 45 d3 20          	movb   $0x20,-0x2d(%ebp)
		altflag = 0;
  800404:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
		precision = -1;
  80040b:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
		width = -1;
  800412:	c7 45 d4 ff ff ff ff 	movl   $0xffffffff,-0x2c(%ebp)
		lflag = 0;
  800419:	b9 00 00 00 00       	mov    $0x0,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  80041e:	8d 47 01             	lea    0x1(%edi),%eax
  800421:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  800424:	0f b6 17             	movzbl (%edi),%edx
  800427:	8d 42 dd             	lea    -0x23(%edx),%eax
  80042a:	3c 55                	cmp    $0x55,%al
  80042c:	0f 87 ae 03 00 00    	ja     8007e0 <vprintfmt+0x3fb>
  800432:	0f b6 c0             	movzbl %al,%eax
  800435:	3e ff 24 85 00 23 80 	notrack jmp *0x802300(,%eax,4)
  80043c:	00 
  80043d:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			padc = '-';
  800440:	c6 45 d3 2d          	movb   $0x2d,-0x2d(%ebp)
  800444:	eb d8                	jmp    80041e <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  800446:	8b 7d e4             	mov    -0x1c(%ebp),%edi
  800449:	c6 45 d3 30          	movb   $0x30,-0x2d(%ebp)
  80044d:	eb cf                	jmp    80041e <vprintfmt+0x39>
  80044f:	0f b6 d2             	movzbl %dl,%edx
  800452:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			for (precision = 0; ; ++fmt) {
  800455:	b8 00 00 00 00       	mov    $0x0,%eax
  80045a:	89 4d e4             	mov    %ecx,-0x1c(%ebp)
				precision = precision * 10 + ch - '0';
  80045d:	8d 04 80             	lea    (%eax,%eax,4),%eax
  800460:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
				ch = *fmt;
  800464:	0f be 17             	movsbl (%edi),%edx
				if (ch < '0' || ch > '9')
  800467:	8d 4a d0             	lea    -0x30(%edx),%ecx
  80046a:	83 f9 09             	cmp    $0x9,%ecx
  80046d:	77 55                	ja     8004c4 <vprintfmt+0xdf>
			for (precision = 0; ; ++fmt) {
  80046f:	83 c7 01             	add    $0x1,%edi
				precision = precision * 10 + ch - '0';
  800472:	eb e9                	jmp    80045d <vprintfmt+0x78>
			precision = va_arg(ap, int);
  800474:	8b 45 14             	mov    0x14(%ebp),%eax
  800477:	8b 00                	mov    (%eax),%eax
  800479:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80047c:	8b 45 14             	mov    0x14(%ebp),%eax
  80047f:	8d 40 04             	lea    0x4(%eax),%eax
  800482:	89 45 14             	mov    %eax,0x14(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  800485:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			if (width < 0)
  800488:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  80048c:	79 90                	jns    80041e <vprintfmt+0x39>
				width = precision, precision = -1;
  80048e:	8b 45 d8             	mov    -0x28(%ebp),%eax
  800491:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  800494:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
  80049b:	eb 81                	jmp    80041e <vprintfmt+0x39>
  80049d:	8b 45 d4             	mov    -0x2c(%ebp),%eax
  8004a0:	85 c0                	test   %eax,%eax
  8004a2:	ba 00 00 00 00       	mov    $0x0,%edx
  8004a7:	0f 49 d0             	cmovns %eax,%edx
  8004aa:	89 55 d4             	mov    %edx,-0x2c(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  8004ad:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  8004b0:	e9 69 ff ff ff       	jmp    80041e <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  8004b5:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			altflag = 1;
  8004b8:	c7 45 e0 01 00 00 00 	movl   $0x1,-0x20(%ebp)
			goto reswitch;
  8004bf:	e9 5a ff ff ff       	jmp    80041e <vprintfmt+0x39>
  8004c4:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
  8004c7:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8004ca:	eb bc                	jmp    800488 <vprintfmt+0xa3>
			lflag++;
  8004cc:	83 c1 01             	add    $0x1,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  8004cf:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  8004d2:	e9 47 ff ff ff       	jmp    80041e <vprintfmt+0x39>
			putch(va_arg(ap, int), putdat);
  8004d7:	8b 45 14             	mov    0x14(%ebp),%eax
  8004da:	8d 78 04             	lea    0x4(%eax),%edi
  8004dd:	83 ec 08             	sub    $0x8,%esp
  8004e0:	53                   	push   %ebx
  8004e1:	ff 30                	pushl  (%eax)
  8004e3:	ff d6                	call   *%esi
			break;
  8004e5:	83 c4 10             	add    $0x10,%esp
			putch(va_arg(ap, int), putdat);
  8004e8:	89 7d 14             	mov    %edi,0x14(%ebp)
			break;
  8004eb:	e9 6a 02 00 00       	jmp    80075a <vprintfmt+0x375>
			err = va_arg(ap, int);
  8004f0:	8b 45 14             	mov    0x14(%ebp),%eax
  8004f3:	8d 78 04             	lea    0x4(%eax),%edi
  8004f6:	8b 00                	mov    (%eax),%eax
  8004f8:	99                   	cltd   
  8004f9:	31 d0                	xor    %edx,%eax
  8004fb:	29 d0                	sub    %edx,%eax
			if (err >= MAXERROR || (p = error_string[err]) == NULL)
  8004fd:	83 f8 0f             	cmp    $0xf,%eax
  800500:	7f 23                	jg     800525 <vprintfmt+0x140>
  800502:	8b 14 85 60 24 80 00 	mov    0x802460(,%eax,4),%edx
  800509:	85 d2                	test   %edx,%edx
  80050b:	74 18                	je     800525 <vprintfmt+0x140>
				printfmt(putch, putdat, "%s", p);
  80050d:	52                   	push   %edx
  80050e:	68 91 25 80 00       	push   $0x802591
  800513:	53                   	push   %ebx
  800514:	56                   	push   %esi
  800515:	e8 aa fe ff ff       	call   8003c4 <printfmt>
  80051a:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  80051d:	89 7d 14             	mov    %edi,0x14(%ebp)
  800520:	e9 35 02 00 00       	jmp    80075a <vprintfmt+0x375>
				printfmt(putch, putdat, "error %d", err);
  800525:	50                   	push   %eax
  800526:	68 e3 21 80 00       	push   $0x8021e3
  80052b:	53                   	push   %ebx
  80052c:	56                   	push   %esi
  80052d:	e8 92 fe ff ff       	call   8003c4 <printfmt>
  800532:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  800535:	89 7d 14             	mov    %edi,0x14(%ebp)
				printfmt(putch, putdat, "error %d", err);
  800538:	e9 1d 02 00 00       	jmp    80075a <vprintfmt+0x375>
			if ((p = va_arg(ap, char *)) == NULL)
  80053d:	8b 45 14             	mov    0x14(%ebp),%eax
  800540:	83 c0 04             	add    $0x4,%eax
  800543:	89 45 c8             	mov    %eax,-0x38(%ebp)
  800546:	8b 45 14             	mov    0x14(%ebp),%eax
  800549:	8b 10                	mov    (%eax),%edx
				p = "(null)";
  80054b:	85 d2                	test   %edx,%edx
  80054d:	b8 dc 21 80 00       	mov    $0x8021dc,%eax
  800552:	0f 45 c2             	cmovne %edx,%eax
  800555:	89 45 cc             	mov    %eax,-0x34(%ebp)
			if (width > 0 && padc != '-')
  800558:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  80055c:	7e 06                	jle    800564 <vprintfmt+0x17f>
  80055e:	80 7d d3 2d          	cmpb   $0x2d,-0x2d(%ebp)
  800562:	75 0d                	jne    800571 <vprintfmt+0x18c>
				for (width -= strnlen(p, precision); width > 0; width--)
  800564:	8b 45 cc             	mov    -0x34(%ebp),%eax
  800567:	89 c7                	mov    %eax,%edi
  800569:	03 45 d4             	add    -0x2c(%ebp),%eax
  80056c:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  80056f:	eb 55                	jmp    8005c6 <vprintfmt+0x1e1>
  800571:	83 ec 08             	sub    $0x8,%esp
  800574:	ff 75 d8             	pushl  -0x28(%ebp)
  800577:	ff 75 cc             	pushl  -0x34(%ebp)
  80057a:	e8 15 03 00 00       	call   800894 <strnlen>
  80057f:	8b 55 d4             	mov    -0x2c(%ebp),%edx
  800582:	29 c2                	sub    %eax,%edx
  800584:	89 55 c4             	mov    %edx,-0x3c(%ebp)
  800587:	83 c4 10             	add    $0x10,%esp
  80058a:	89 d7                	mov    %edx,%edi
					putch(padc, putdat);
  80058c:	0f be 45 d3          	movsbl -0x2d(%ebp),%eax
  800590:	89 45 d4             	mov    %eax,-0x2c(%ebp)
				for (width -= strnlen(p, precision); width > 0; width--)
  800593:	85 ff                	test   %edi,%edi
  800595:	7e 11                	jle    8005a8 <vprintfmt+0x1c3>
					putch(padc, putdat);
  800597:	83 ec 08             	sub    $0x8,%esp
  80059a:	53                   	push   %ebx
  80059b:	ff 75 d4             	pushl  -0x2c(%ebp)
  80059e:	ff d6                	call   *%esi
				for (width -= strnlen(p, precision); width > 0; width--)
  8005a0:	83 ef 01             	sub    $0x1,%edi
  8005a3:	83 c4 10             	add    $0x10,%esp
  8005a6:	eb eb                	jmp    800593 <vprintfmt+0x1ae>
  8005a8:	8b 55 c4             	mov    -0x3c(%ebp),%edx
  8005ab:	85 d2                	test   %edx,%edx
  8005ad:	b8 00 00 00 00       	mov    $0x0,%eax
  8005b2:	0f 49 c2             	cmovns %edx,%eax
  8005b5:	29 c2                	sub    %eax,%edx
  8005b7:	89 55 d4             	mov    %edx,-0x2c(%ebp)
  8005ba:	eb a8                	jmp    800564 <vprintfmt+0x17f>
					putch(ch, putdat);
  8005bc:	83 ec 08             	sub    $0x8,%esp
  8005bf:	53                   	push   %ebx
  8005c0:	52                   	push   %edx
  8005c1:	ff d6                	call   *%esi
  8005c3:	83 c4 10             	add    $0x10,%esp
  8005c6:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
  8005c9:	29 f9                	sub    %edi,%ecx
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
  8005cb:	83 c7 01             	add    $0x1,%edi
  8005ce:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  8005d2:	0f be d0             	movsbl %al,%edx
  8005d5:	85 d2                	test   %edx,%edx
  8005d7:	74 4b                	je     800624 <vprintfmt+0x23f>
  8005d9:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
  8005dd:	78 06                	js     8005e5 <vprintfmt+0x200>
  8005df:	83 6d d8 01          	subl   $0x1,-0x28(%ebp)
  8005e3:	78 1e                	js     800603 <vprintfmt+0x21e>
				if (altflag && (ch < ' ' || ch > '~'))
  8005e5:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
  8005e9:	74 d1                	je     8005bc <vprintfmt+0x1d7>
  8005eb:	0f be c0             	movsbl %al,%eax
  8005ee:	83 e8 20             	sub    $0x20,%eax
  8005f1:	83 f8 5e             	cmp    $0x5e,%eax
  8005f4:	76 c6                	jbe    8005bc <vprintfmt+0x1d7>
					putch('?', putdat);
  8005f6:	83 ec 08             	sub    $0x8,%esp
  8005f9:	53                   	push   %ebx
  8005fa:	6a 3f                	push   $0x3f
  8005fc:	ff d6                	call   *%esi
  8005fe:	83 c4 10             	add    $0x10,%esp
  800601:	eb c3                	jmp    8005c6 <vprintfmt+0x1e1>
  800603:	89 cf                	mov    %ecx,%edi
  800605:	eb 0e                	jmp    800615 <vprintfmt+0x230>
				putch(' ', putdat);
  800607:	83 ec 08             	sub    $0x8,%esp
  80060a:	53                   	push   %ebx
  80060b:	6a 20                	push   $0x20
  80060d:	ff d6                	call   *%esi
			for (; width > 0; width--)
  80060f:	83 ef 01             	sub    $0x1,%edi
  800612:	83 c4 10             	add    $0x10,%esp
  800615:	85 ff                	test   %edi,%edi
  800617:	7f ee                	jg     800607 <vprintfmt+0x222>
			if ((p = va_arg(ap, char *)) == NULL)
  800619:	8b 45 c8             	mov    -0x38(%ebp),%eax
  80061c:	89 45 14             	mov    %eax,0x14(%ebp)
  80061f:	e9 36 01 00 00       	jmp    80075a <vprintfmt+0x375>
  800624:	89 cf                	mov    %ecx,%edi
  800626:	eb ed                	jmp    800615 <vprintfmt+0x230>
	if (lflag >= 2)
  800628:	83 f9 01             	cmp    $0x1,%ecx
  80062b:	7f 1f                	jg     80064c <vprintfmt+0x267>
	else if (lflag)
  80062d:	85 c9                	test   %ecx,%ecx
  80062f:	74 67                	je     800698 <vprintfmt+0x2b3>
		return va_arg(*ap, long);
  800631:	8b 45 14             	mov    0x14(%ebp),%eax
  800634:	8b 00                	mov    (%eax),%eax
  800636:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800639:	89 c1                	mov    %eax,%ecx
  80063b:	c1 f9 1f             	sar    $0x1f,%ecx
  80063e:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  800641:	8b 45 14             	mov    0x14(%ebp),%eax
  800644:	8d 40 04             	lea    0x4(%eax),%eax
  800647:	89 45 14             	mov    %eax,0x14(%ebp)
  80064a:	eb 17                	jmp    800663 <vprintfmt+0x27e>
		return va_arg(*ap, long long);
  80064c:	8b 45 14             	mov    0x14(%ebp),%eax
  80064f:	8b 50 04             	mov    0x4(%eax),%edx
  800652:	8b 00                	mov    (%eax),%eax
  800654:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800657:	89 55 dc             	mov    %edx,-0x24(%ebp)
  80065a:	8b 45 14             	mov    0x14(%ebp),%eax
  80065d:	8d 40 08             	lea    0x8(%eax),%eax
  800660:	89 45 14             	mov    %eax,0x14(%ebp)
			if ((long long) num < 0) {
  800663:	8b 55 d8             	mov    -0x28(%ebp),%edx
  800666:	8b 4d dc             	mov    -0x24(%ebp),%ecx
			base = 10;
  800669:	b8 0a 00 00 00       	mov    $0xa,%eax
			if ((long long) num < 0) {
  80066e:	85 c9                	test   %ecx,%ecx
  800670:	0f 89 ca 00 00 00    	jns    800740 <vprintfmt+0x35b>
				putch('-', putdat);
  800676:	83 ec 08             	sub    $0x8,%esp
  800679:	53                   	push   %ebx
  80067a:	6a 2d                	push   $0x2d
  80067c:	ff d6                	call   *%esi
				num = -(long long) num;
  80067e:	8b 55 d8             	mov    -0x28(%ebp),%edx
  800681:	8b 4d dc             	mov    -0x24(%ebp),%ecx
  800684:	f7 da                	neg    %edx
  800686:	83 d1 00             	adc    $0x0,%ecx
  800689:	f7 d9                	neg    %ecx
  80068b:	83 c4 10             	add    $0x10,%esp
			base = 10;
  80068e:	b8 0a 00 00 00       	mov    $0xa,%eax
  800693:	e9 a8 00 00 00       	jmp    800740 <vprintfmt+0x35b>
		return va_arg(*ap, int);
  800698:	8b 45 14             	mov    0x14(%ebp),%eax
  80069b:	8b 00                	mov    (%eax),%eax
  80069d:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8006a0:	99                   	cltd   
  8006a1:	89 55 dc             	mov    %edx,-0x24(%ebp)
  8006a4:	8b 45 14             	mov    0x14(%ebp),%eax
  8006a7:	8d 40 04             	lea    0x4(%eax),%eax
  8006aa:	89 45 14             	mov    %eax,0x14(%ebp)
  8006ad:	eb b4                	jmp    800663 <vprintfmt+0x27e>
	if (lflag >= 2)
  8006af:	83 f9 01             	cmp    $0x1,%ecx
  8006b2:	7f 1b                	jg     8006cf <vprintfmt+0x2ea>
	else if (lflag)
  8006b4:	85 c9                	test   %ecx,%ecx
  8006b6:	74 2c                	je     8006e4 <vprintfmt+0x2ff>
		return va_arg(*ap, unsigned long);
  8006b8:	8b 45 14             	mov    0x14(%ebp),%eax
  8006bb:	8b 10                	mov    (%eax),%edx
  8006bd:	b9 00 00 00 00       	mov    $0x0,%ecx
  8006c2:	8d 40 04             	lea    0x4(%eax),%eax
  8006c5:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  8006c8:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long);
  8006cd:	eb 71                	jmp    800740 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  8006cf:	8b 45 14             	mov    0x14(%ebp),%eax
  8006d2:	8b 10                	mov    (%eax),%edx
  8006d4:	8b 48 04             	mov    0x4(%eax),%ecx
  8006d7:	8d 40 08             	lea    0x8(%eax),%eax
  8006da:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  8006dd:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long long);
  8006e2:	eb 5c                	jmp    800740 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  8006e4:	8b 45 14             	mov    0x14(%ebp),%eax
  8006e7:	8b 10                	mov    (%eax),%edx
  8006e9:	b9 00 00 00 00       	mov    $0x0,%ecx
  8006ee:	8d 40 04             	lea    0x4(%eax),%eax
  8006f1:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  8006f4:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned int);
  8006f9:	eb 45                	jmp    800740 <vprintfmt+0x35b>
			putch('X', putdat);
  8006fb:	83 ec 08             	sub    $0x8,%esp
  8006fe:	53                   	push   %ebx
  8006ff:	6a 58                	push   $0x58
  800701:	ff d6                	call   *%esi
			putch('X', putdat);
  800703:	83 c4 08             	add    $0x8,%esp
  800706:	53                   	push   %ebx
  800707:	6a 58                	push   $0x58
  800709:	ff d6                	call   *%esi
			putch('X', putdat);
  80070b:	83 c4 08             	add    $0x8,%esp
  80070e:	53                   	push   %ebx
  80070f:	6a 58                	push   $0x58
  800711:	ff d6                	call   *%esi
			break;
  800713:	83 c4 10             	add    $0x10,%esp
  800716:	eb 42                	jmp    80075a <vprintfmt+0x375>
			putch('0', putdat);
  800718:	83 ec 08             	sub    $0x8,%esp
  80071b:	53                   	push   %ebx
  80071c:	6a 30                	push   $0x30
  80071e:	ff d6                	call   *%esi
			putch('x', putdat);
  800720:	83 c4 08             	add    $0x8,%esp
  800723:	53                   	push   %ebx
  800724:	6a 78                	push   $0x78
  800726:	ff d6                	call   *%esi
			num = (unsigned long long)
  800728:	8b 45 14             	mov    0x14(%ebp),%eax
  80072b:	8b 10                	mov    (%eax),%edx
  80072d:	b9 00 00 00 00       	mov    $0x0,%ecx
			goto number;
  800732:	83 c4 10             	add    $0x10,%esp
				(uintptr_t) va_arg(ap, void *);
  800735:	8d 40 04             	lea    0x4(%eax),%eax
  800738:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  80073b:	b8 10 00 00 00       	mov    $0x10,%eax
			printnum(putch, putdat, num, base, width, padc);
  800740:	83 ec 0c             	sub    $0xc,%esp
  800743:	0f be 7d d3          	movsbl -0x2d(%ebp),%edi
  800747:	57                   	push   %edi
  800748:	ff 75 d4             	pushl  -0x2c(%ebp)
  80074b:	50                   	push   %eax
  80074c:	51                   	push   %ecx
  80074d:	52                   	push   %edx
  80074e:	89 da                	mov    %ebx,%edx
  800750:	89 f0                	mov    %esi,%eax
  800752:	e8 a3 fb ff ff       	call   8002fa <printnum>
			break;
  800757:	83 c4 20             	add    $0x20,%esp
			if ((p = va_arg(ap, char *)) == NULL)
  80075a:	8b 7d e4             	mov    -0x1c(%ebp),%edi
		while ((ch = *(unsigned char *) fmt++) != '%') {
  80075d:	83 c7 01             	add    $0x1,%edi
  800760:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  800764:	83 f8 25             	cmp    $0x25,%eax
  800767:	0f 84 93 fc ff ff    	je     800400 <vprintfmt+0x1b>
			if (ch == '\0')
  80076d:	85 c0                	test   %eax,%eax
  80076f:	0f 84 8b 00 00 00    	je     800800 <vprintfmt+0x41b>
			putch(ch, putdat);
  800775:	83 ec 08             	sub    $0x8,%esp
  800778:	53                   	push   %ebx
  800779:	50                   	push   %eax
  80077a:	ff d6                	call   *%esi
  80077c:	83 c4 10             	add    $0x10,%esp
  80077f:	eb dc                	jmp    80075d <vprintfmt+0x378>
	if (lflag >= 2)
  800781:	83 f9 01             	cmp    $0x1,%ecx
  800784:	7f 1b                	jg     8007a1 <vprintfmt+0x3bc>
	else if (lflag)
  800786:	85 c9                	test   %ecx,%ecx
  800788:	74 2c                	je     8007b6 <vprintfmt+0x3d1>
		return va_arg(*ap, unsigned long);
  80078a:	8b 45 14             	mov    0x14(%ebp),%eax
  80078d:	8b 10                	mov    (%eax),%edx
  80078f:	b9 00 00 00 00       	mov    $0x0,%ecx
  800794:	8d 40 04             	lea    0x4(%eax),%eax
  800797:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  80079a:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long);
  80079f:	eb 9f                	jmp    800740 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  8007a1:	8b 45 14             	mov    0x14(%ebp),%eax
  8007a4:	8b 10                	mov    (%eax),%edx
  8007a6:	8b 48 04             	mov    0x4(%eax),%ecx
  8007a9:	8d 40 08             	lea    0x8(%eax),%eax
  8007ac:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8007af:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long long);
  8007b4:	eb 8a                	jmp    800740 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  8007b6:	8b 45 14             	mov    0x14(%ebp),%eax
  8007b9:	8b 10                	mov    (%eax),%edx
  8007bb:	b9 00 00 00 00       	mov    $0x0,%ecx
  8007c0:	8d 40 04             	lea    0x4(%eax),%eax
  8007c3:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8007c6:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned int);
  8007cb:	e9 70 ff ff ff       	jmp    800740 <vprintfmt+0x35b>
			putch(ch, putdat);
  8007d0:	83 ec 08             	sub    $0x8,%esp
  8007d3:	53                   	push   %ebx
  8007d4:	6a 25                	push   $0x25
  8007d6:	ff d6                	call   *%esi
			break;
  8007d8:	83 c4 10             	add    $0x10,%esp
  8007db:	e9 7a ff ff ff       	jmp    80075a <vprintfmt+0x375>
			putch('%', putdat);
  8007e0:	83 ec 08             	sub    $0x8,%esp
  8007e3:	53                   	push   %ebx
  8007e4:	6a 25                	push   $0x25
  8007e6:	ff d6                	call   *%esi
			for (fmt--; fmt[-1] != '%'; fmt--)
  8007e8:	83 c4 10             	add    $0x10,%esp
  8007eb:	89 f8                	mov    %edi,%eax
  8007ed:	80 78 ff 25          	cmpb   $0x25,-0x1(%eax)
  8007f1:	74 05                	je     8007f8 <vprintfmt+0x413>
  8007f3:	83 e8 01             	sub    $0x1,%eax
  8007f6:	eb f5                	jmp    8007ed <vprintfmt+0x408>
  8007f8:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  8007fb:	e9 5a ff ff ff       	jmp    80075a <vprintfmt+0x375>
}
  800800:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800803:	5b                   	pop    %ebx
  800804:	5e                   	pop    %esi
  800805:	5f                   	pop    %edi
  800806:	5d                   	pop    %ebp
  800807:	c3                   	ret    

00800808 <vsnprintf>:

int
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
  800808:	f3 0f 1e fb          	endbr32 
  80080c:	55                   	push   %ebp
  80080d:	89 e5                	mov    %esp,%ebp
  80080f:	83 ec 18             	sub    $0x18,%esp
  800812:	8b 45 08             	mov    0x8(%ebp),%eax
  800815:	8b 55 0c             	mov    0xc(%ebp),%edx
	struct sprintbuf b = {buf, buf+n-1, 0};
  800818:	89 45 ec             	mov    %eax,-0x14(%ebp)
  80081b:	8d 4c 10 ff          	lea    -0x1(%eax,%edx,1),%ecx
  80081f:	89 4d f0             	mov    %ecx,-0x10(%ebp)
  800822:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

	if (buf == NULL || n < 1)
  800829:	85 c0                	test   %eax,%eax
  80082b:	74 26                	je     800853 <vsnprintf+0x4b>
  80082d:	85 d2                	test   %edx,%edx
  80082f:	7e 22                	jle    800853 <vsnprintf+0x4b>
		return -E_INVAL;

	// print the string to the buffer
	vprintfmt((void*)sprintputch, &b, fmt, ap);
  800831:	ff 75 14             	pushl  0x14(%ebp)
  800834:	ff 75 10             	pushl  0x10(%ebp)
  800837:	8d 45 ec             	lea    -0x14(%ebp),%eax
  80083a:	50                   	push   %eax
  80083b:	68 a3 03 80 00       	push   $0x8003a3
  800840:	e8 a0 fb ff ff       	call   8003e5 <vprintfmt>

	// null terminate the buffer
	*b.buf = '\0';
  800845:	8b 45 ec             	mov    -0x14(%ebp),%eax
  800848:	c6 00 00             	movb   $0x0,(%eax)

	return b.cnt;
  80084b:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80084e:	83 c4 10             	add    $0x10,%esp
}
  800851:	c9                   	leave  
  800852:	c3                   	ret    
		return -E_INVAL;
  800853:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  800858:	eb f7                	jmp    800851 <vsnprintf+0x49>

0080085a <snprintf>:

int
snprintf(char *buf, int n, const char *fmt, ...)
{
  80085a:	f3 0f 1e fb          	endbr32 
  80085e:	55                   	push   %ebp
  80085f:	89 e5                	mov    %esp,%ebp
  800861:	83 ec 08             	sub    $0x8,%esp
	va_list ap;
	int rc;

	va_start(ap, fmt);
  800864:	8d 45 14             	lea    0x14(%ebp),%eax
	rc = vsnprintf(buf, n, fmt, ap);
  800867:	50                   	push   %eax
  800868:	ff 75 10             	pushl  0x10(%ebp)
  80086b:	ff 75 0c             	pushl  0xc(%ebp)
  80086e:	ff 75 08             	pushl  0x8(%ebp)
  800871:	e8 92 ff ff ff       	call   800808 <vsnprintf>
	va_end(ap);

	return rc;
}
  800876:	c9                   	leave  
  800877:	c3                   	ret    

00800878 <strlen>:
// Primespipe runs 3x faster this way.
#define ASM 1

int
strlen(const char *s)
{
  800878:	f3 0f 1e fb          	endbr32 
  80087c:	55                   	push   %ebp
  80087d:	89 e5                	mov    %esp,%ebp
  80087f:	8b 55 08             	mov    0x8(%ebp),%edx
	int n;

	for (n = 0; *s != '\0'; s++)
  800882:	b8 00 00 00 00       	mov    $0x0,%eax
  800887:	80 3c 02 00          	cmpb   $0x0,(%edx,%eax,1)
  80088b:	74 05                	je     800892 <strlen+0x1a>
		n++;
  80088d:	83 c0 01             	add    $0x1,%eax
  800890:	eb f5                	jmp    800887 <strlen+0xf>
	return n;
}
  800892:	5d                   	pop    %ebp
  800893:	c3                   	ret    

00800894 <strnlen>:

int
strnlen(const char *s, size_t size)
{
  800894:	f3 0f 1e fb          	endbr32 
  800898:	55                   	push   %ebp
  800899:	89 e5                	mov    %esp,%ebp
  80089b:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80089e:	8b 55 0c             	mov    0xc(%ebp),%edx
	int n;

	for (n = 0; size > 0 && *s != '\0'; s++, size--)
  8008a1:	b8 00 00 00 00       	mov    $0x0,%eax
  8008a6:	39 d0                	cmp    %edx,%eax
  8008a8:	74 0d                	je     8008b7 <strnlen+0x23>
  8008aa:	80 3c 01 00          	cmpb   $0x0,(%ecx,%eax,1)
  8008ae:	74 05                	je     8008b5 <strnlen+0x21>
		n++;
  8008b0:	83 c0 01             	add    $0x1,%eax
  8008b3:	eb f1                	jmp    8008a6 <strnlen+0x12>
  8008b5:	89 c2                	mov    %eax,%edx
	return n;
}
  8008b7:	89 d0                	mov    %edx,%eax
  8008b9:	5d                   	pop    %ebp
  8008ba:	c3                   	ret    

008008bb <strcpy>:

char *
strcpy(char *dst, const char *src)
{
  8008bb:	f3 0f 1e fb          	endbr32 
  8008bf:	55                   	push   %ebp
  8008c0:	89 e5                	mov    %esp,%ebp
  8008c2:	53                   	push   %ebx
  8008c3:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8008c6:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	char *ret;

	ret = dst;
	while ((*dst++ = *src++) != '\0')
  8008c9:	b8 00 00 00 00       	mov    $0x0,%eax
  8008ce:	0f b6 14 03          	movzbl (%ebx,%eax,1),%edx
  8008d2:	88 14 01             	mov    %dl,(%ecx,%eax,1)
  8008d5:	83 c0 01             	add    $0x1,%eax
  8008d8:	84 d2                	test   %dl,%dl
  8008da:	75 f2                	jne    8008ce <strcpy+0x13>
		/* do nothing */;
	return ret;
}
  8008dc:	89 c8                	mov    %ecx,%eax
  8008de:	5b                   	pop    %ebx
  8008df:	5d                   	pop    %ebp
  8008e0:	c3                   	ret    

008008e1 <strcat>:

char *
strcat(char *dst, const char *src)
{
  8008e1:	f3 0f 1e fb          	endbr32 
  8008e5:	55                   	push   %ebp
  8008e6:	89 e5                	mov    %esp,%ebp
  8008e8:	53                   	push   %ebx
  8008e9:	83 ec 10             	sub    $0x10,%esp
  8008ec:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int len = strlen(dst);
  8008ef:	53                   	push   %ebx
  8008f0:	e8 83 ff ff ff       	call   800878 <strlen>
  8008f5:	83 c4 08             	add    $0x8,%esp
	strcpy(dst + len, src);
  8008f8:	ff 75 0c             	pushl  0xc(%ebp)
  8008fb:	01 d8                	add    %ebx,%eax
  8008fd:	50                   	push   %eax
  8008fe:	e8 b8 ff ff ff       	call   8008bb <strcpy>
	return dst;
}
  800903:	89 d8                	mov    %ebx,%eax
  800905:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  800908:	c9                   	leave  
  800909:	c3                   	ret    

0080090a <strncpy>:

char *
strncpy(char *dst, const char *src, size_t size) {
  80090a:	f3 0f 1e fb          	endbr32 
  80090e:	55                   	push   %ebp
  80090f:	89 e5                	mov    %esp,%ebp
  800911:	56                   	push   %esi
  800912:	53                   	push   %ebx
  800913:	8b 75 08             	mov    0x8(%ebp),%esi
  800916:	8b 55 0c             	mov    0xc(%ebp),%edx
  800919:	89 f3                	mov    %esi,%ebx
  80091b:	03 5d 10             	add    0x10(%ebp),%ebx
	size_t i;
	char *ret;

	ret = dst;
	for (i = 0; i < size; i++) {
  80091e:	89 f0                	mov    %esi,%eax
  800920:	39 d8                	cmp    %ebx,%eax
  800922:	74 11                	je     800935 <strncpy+0x2b>
		*dst++ = *src;
  800924:	83 c0 01             	add    $0x1,%eax
  800927:	0f b6 0a             	movzbl (%edx),%ecx
  80092a:	88 48 ff             	mov    %cl,-0x1(%eax)
		// If strlen(src) < size, null-pad 'dst' out to 'size' chars
		if (*src != '\0')
			src++;
  80092d:	80 f9 01             	cmp    $0x1,%cl
  800930:	83 da ff             	sbb    $0xffffffff,%edx
  800933:	eb eb                	jmp    800920 <strncpy+0x16>
	}
	return ret;
}
  800935:	89 f0                	mov    %esi,%eax
  800937:	5b                   	pop    %ebx
  800938:	5e                   	pop    %esi
  800939:	5d                   	pop    %ebp
  80093a:	c3                   	ret    

0080093b <strlcpy>:

size_t
strlcpy(char *dst, const char *src, size_t size)
{
  80093b:	f3 0f 1e fb          	endbr32 
  80093f:	55                   	push   %ebp
  800940:	89 e5                	mov    %esp,%ebp
  800942:	56                   	push   %esi
  800943:	53                   	push   %ebx
  800944:	8b 75 08             	mov    0x8(%ebp),%esi
  800947:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  80094a:	8b 55 10             	mov    0x10(%ebp),%edx
  80094d:	89 f0                	mov    %esi,%eax
	char *dst_in;

	dst_in = dst;
	if (size > 0) {
  80094f:	85 d2                	test   %edx,%edx
  800951:	74 21                	je     800974 <strlcpy+0x39>
  800953:	8d 44 16 ff          	lea    -0x1(%esi,%edx,1),%eax
  800957:	89 f2                	mov    %esi,%edx
		while (--size > 0 && *src != '\0')
  800959:	39 c2                	cmp    %eax,%edx
  80095b:	74 14                	je     800971 <strlcpy+0x36>
  80095d:	0f b6 19             	movzbl (%ecx),%ebx
  800960:	84 db                	test   %bl,%bl
  800962:	74 0b                	je     80096f <strlcpy+0x34>
			*dst++ = *src++;
  800964:	83 c1 01             	add    $0x1,%ecx
  800967:	83 c2 01             	add    $0x1,%edx
  80096a:	88 5a ff             	mov    %bl,-0x1(%edx)
  80096d:	eb ea                	jmp    800959 <strlcpy+0x1e>
  80096f:	89 d0                	mov    %edx,%eax
		*dst = '\0';
  800971:	c6 00 00             	movb   $0x0,(%eax)
	}
	return dst - dst_in;
  800974:	29 f0                	sub    %esi,%eax
}
  800976:	5b                   	pop    %ebx
  800977:	5e                   	pop    %esi
  800978:	5d                   	pop    %ebp
  800979:	c3                   	ret    

0080097a <strcmp>:

int
strcmp(const char *p, const char *q)
{
  80097a:	f3 0f 1e fb          	endbr32 
  80097e:	55                   	push   %ebp
  80097f:	89 e5                	mov    %esp,%ebp
  800981:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800984:	8b 55 0c             	mov    0xc(%ebp),%edx
	while (*p && *p == *q)
  800987:	0f b6 01             	movzbl (%ecx),%eax
  80098a:	84 c0                	test   %al,%al
  80098c:	74 0c                	je     80099a <strcmp+0x20>
  80098e:	3a 02                	cmp    (%edx),%al
  800990:	75 08                	jne    80099a <strcmp+0x20>
		p++, q++;
  800992:	83 c1 01             	add    $0x1,%ecx
  800995:	83 c2 01             	add    $0x1,%edx
  800998:	eb ed                	jmp    800987 <strcmp+0xd>
	return (int) ((unsigned char) *p - (unsigned char) *q);
  80099a:	0f b6 c0             	movzbl %al,%eax
  80099d:	0f b6 12             	movzbl (%edx),%edx
  8009a0:	29 d0                	sub    %edx,%eax
}
  8009a2:	5d                   	pop    %ebp
  8009a3:	c3                   	ret    

008009a4 <strncmp>:

int
strncmp(const char *p, const char *q, size_t n)
{
  8009a4:	f3 0f 1e fb          	endbr32 
  8009a8:	55                   	push   %ebp
  8009a9:	89 e5                	mov    %esp,%ebp
  8009ab:	53                   	push   %ebx
  8009ac:	8b 45 08             	mov    0x8(%ebp),%eax
  8009af:	8b 55 0c             	mov    0xc(%ebp),%edx
  8009b2:	89 c3                	mov    %eax,%ebx
  8009b4:	03 5d 10             	add    0x10(%ebp),%ebx
	while (n > 0 && *p && *p == *q)
  8009b7:	eb 06                	jmp    8009bf <strncmp+0x1b>
		n--, p++, q++;
  8009b9:	83 c0 01             	add    $0x1,%eax
  8009bc:	83 c2 01             	add    $0x1,%edx
	while (n > 0 && *p && *p == *q)
  8009bf:	39 d8                	cmp    %ebx,%eax
  8009c1:	74 16                	je     8009d9 <strncmp+0x35>
  8009c3:	0f b6 08             	movzbl (%eax),%ecx
  8009c6:	84 c9                	test   %cl,%cl
  8009c8:	74 04                	je     8009ce <strncmp+0x2a>
  8009ca:	3a 0a                	cmp    (%edx),%cl
  8009cc:	74 eb                	je     8009b9 <strncmp+0x15>
	if (n == 0)
		return 0;
	else
		return (int) ((unsigned char) *p - (unsigned char) *q);
  8009ce:	0f b6 00             	movzbl (%eax),%eax
  8009d1:	0f b6 12             	movzbl (%edx),%edx
  8009d4:	29 d0                	sub    %edx,%eax
}
  8009d6:	5b                   	pop    %ebx
  8009d7:	5d                   	pop    %ebp
  8009d8:	c3                   	ret    
		return 0;
  8009d9:	b8 00 00 00 00       	mov    $0x0,%eax
  8009de:	eb f6                	jmp    8009d6 <strncmp+0x32>

008009e0 <strchr>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
  8009e0:	f3 0f 1e fb          	endbr32 
  8009e4:	55                   	push   %ebp
  8009e5:	89 e5                	mov    %esp,%ebp
  8009e7:	8b 45 08             	mov    0x8(%ebp),%eax
  8009ea:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  8009ee:	0f b6 10             	movzbl (%eax),%edx
  8009f1:	84 d2                	test   %dl,%dl
  8009f3:	74 09                	je     8009fe <strchr+0x1e>
		if (*s == c)
  8009f5:	38 ca                	cmp    %cl,%dl
  8009f7:	74 0a                	je     800a03 <strchr+0x23>
	for (; *s; s++)
  8009f9:	83 c0 01             	add    $0x1,%eax
  8009fc:	eb f0                	jmp    8009ee <strchr+0xe>
			return (char *) s;
	return 0;
  8009fe:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800a03:	5d                   	pop    %ebp
  800a04:	c3                   	ret    

00800a05 <strfind>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
  800a05:	f3 0f 1e fb          	endbr32 
  800a09:	55                   	push   %ebp
  800a0a:	89 e5                	mov    %esp,%ebp
  800a0c:	8b 45 08             	mov    0x8(%ebp),%eax
  800a0f:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800a13:	0f b6 10             	movzbl (%eax),%edx
		if (*s == c)
  800a16:	38 ca                	cmp    %cl,%dl
  800a18:	74 09                	je     800a23 <strfind+0x1e>
  800a1a:	84 d2                	test   %dl,%dl
  800a1c:	74 05                	je     800a23 <strfind+0x1e>
	for (; *s; s++)
  800a1e:	83 c0 01             	add    $0x1,%eax
  800a21:	eb f0                	jmp    800a13 <strfind+0xe>
			break;
	return (char *) s;
}
  800a23:	5d                   	pop    %ebp
  800a24:	c3                   	ret    

00800a25 <memset>:

#if ASM
void *
memset(void *v, int c, size_t n)
{
  800a25:	f3 0f 1e fb          	endbr32 
  800a29:	55                   	push   %ebp
  800a2a:	89 e5                	mov    %esp,%ebp
  800a2c:	57                   	push   %edi
  800a2d:	56                   	push   %esi
  800a2e:	53                   	push   %ebx
  800a2f:	8b 7d 08             	mov    0x8(%ebp),%edi
  800a32:	8b 4d 10             	mov    0x10(%ebp),%ecx
	char *p;

	if (n == 0)
  800a35:	85 c9                	test   %ecx,%ecx
  800a37:	74 31                	je     800a6a <memset+0x45>
		return v;
	if ((int)v%4 == 0 && n%4 == 0) {
  800a39:	89 f8                	mov    %edi,%eax
  800a3b:	09 c8                	or     %ecx,%eax
  800a3d:	a8 03                	test   $0x3,%al
  800a3f:	75 23                	jne    800a64 <memset+0x3f>
		c &= 0xFF;
  800a41:	0f b6 55 0c          	movzbl 0xc(%ebp),%edx
		c = (c<<24)|(c<<16)|(c<<8)|c;
  800a45:	89 d3                	mov    %edx,%ebx
  800a47:	c1 e3 08             	shl    $0x8,%ebx
  800a4a:	89 d0                	mov    %edx,%eax
  800a4c:	c1 e0 18             	shl    $0x18,%eax
  800a4f:	89 d6                	mov    %edx,%esi
  800a51:	c1 e6 10             	shl    $0x10,%esi
  800a54:	09 f0                	or     %esi,%eax
  800a56:	09 c2                	or     %eax,%edx
  800a58:	09 da                	or     %ebx,%edx
		asm volatile("cld; rep stosl\n"
			:: "D" (v), "a" (c), "c" (n/4)
  800a5a:	c1 e9 02             	shr    $0x2,%ecx
		asm volatile("cld; rep stosl\n"
  800a5d:	89 d0                	mov    %edx,%eax
  800a5f:	fc                   	cld    
  800a60:	f3 ab                	rep stos %eax,%es:(%edi)
  800a62:	eb 06                	jmp    800a6a <memset+0x45>
			: "cc", "memory");
	} else
		asm volatile("cld; rep stosb\n"
  800a64:	8b 45 0c             	mov    0xc(%ebp),%eax
  800a67:	fc                   	cld    
  800a68:	f3 aa                	rep stos %al,%es:(%edi)
			:: "D" (v), "a" (c), "c" (n)
			: "cc", "memory");
	return v;
}
  800a6a:	89 f8                	mov    %edi,%eax
  800a6c:	5b                   	pop    %ebx
  800a6d:	5e                   	pop    %esi
  800a6e:	5f                   	pop    %edi
  800a6f:	5d                   	pop    %ebp
  800a70:	c3                   	ret    

00800a71 <memmove>:

void *
memmove(void *dst, const void *src, size_t n)
{
  800a71:	f3 0f 1e fb          	endbr32 
  800a75:	55                   	push   %ebp
  800a76:	89 e5                	mov    %esp,%ebp
  800a78:	57                   	push   %edi
  800a79:	56                   	push   %esi
  800a7a:	8b 45 08             	mov    0x8(%ebp),%eax
  800a7d:	8b 75 0c             	mov    0xc(%ebp),%esi
  800a80:	8b 4d 10             	mov    0x10(%ebp),%ecx
	const char *s;
	char *d;

	s = src;
	d = dst;
	if (s < d && s + n > d) {
  800a83:	39 c6                	cmp    %eax,%esi
  800a85:	73 32                	jae    800ab9 <memmove+0x48>
  800a87:	8d 14 0e             	lea    (%esi,%ecx,1),%edx
  800a8a:	39 c2                	cmp    %eax,%edx
  800a8c:	76 2b                	jbe    800ab9 <memmove+0x48>
		s += n;
		d += n;
  800a8e:	8d 3c 08             	lea    (%eax,%ecx,1),%edi
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800a91:	89 fe                	mov    %edi,%esi
  800a93:	09 ce                	or     %ecx,%esi
  800a95:	09 d6                	or     %edx,%esi
  800a97:	f7 c6 03 00 00 00    	test   $0x3,%esi
  800a9d:	75 0e                	jne    800aad <memmove+0x3c>
			asm volatile("std; rep movsl\n"
				:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
  800a9f:	83 ef 04             	sub    $0x4,%edi
  800aa2:	8d 72 fc             	lea    -0x4(%edx),%esi
  800aa5:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("std; rep movsl\n"
  800aa8:	fd                   	std    
  800aa9:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800aab:	eb 09                	jmp    800ab6 <memmove+0x45>
		else
			asm volatile("std; rep movsb\n"
				:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
  800aad:	83 ef 01             	sub    $0x1,%edi
  800ab0:	8d 72 ff             	lea    -0x1(%edx),%esi
			asm volatile("std; rep movsb\n"
  800ab3:	fd                   	std    
  800ab4:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
		// Some versions of GCC rely on DF being clear
		asm volatile("cld" ::: "cc");
  800ab6:	fc                   	cld    
  800ab7:	eb 1a                	jmp    800ad3 <memmove+0x62>
	} else {
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800ab9:	89 c2                	mov    %eax,%edx
  800abb:	09 ca                	or     %ecx,%edx
  800abd:	09 f2                	or     %esi,%edx
  800abf:	f6 c2 03             	test   $0x3,%dl
  800ac2:	75 0a                	jne    800ace <memmove+0x5d>
			asm volatile("cld; rep movsl\n"
				:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
  800ac4:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("cld; rep movsl\n"
  800ac7:	89 c7                	mov    %eax,%edi
  800ac9:	fc                   	cld    
  800aca:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800acc:	eb 05                	jmp    800ad3 <memmove+0x62>
		else
			asm volatile("cld; rep movsb\n"
  800ace:	89 c7                	mov    %eax,%edi
  800ad0:	fc                   	cld    
  800ad1:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
				:: "D" (d), "S" (s), "c" (n) : "cc", "memory");
	}
	return dst;
}
  800ad3:	5e                   	pop    %esi
  800ad4:	5f                   	pop    %edi
  800ad5:	5d                   	pop    %ebp
  800ad6:	c3                   	ret    

00800ad7 <memcpy>:
}
#endif

void *
memcpy(void *dst, const void *src, size_t n)
{
  800ad7:	f3 0f 1e fb          	endbr32 
  800adb:	55                   	push   %ebp
  800adc:	89 e5                	mov    %esp,%ebp
  800ade:	83 ec 0c             	sub    $0xc,%esp
	return memmove(dst, src, n);
  800ae1:	ff 75 10             	pushl  0x10(%ebp)
  800ae4:	ff 75 0c             	pushl  0xc(%ebp)
  800ae7:	ff 75 08             	pushl  0x8(%ebp)
  800aea:	e8 82 ff ff ff       	call   800a71 <memmove>
}
  800aef:	c9                   	leave  
  800af0:	c3                   	ret    

00800af1 <memcmp>:

int
memcmp(const void *v1, const void *v2, size_t n)
{
  800af1:	f3 0f 1e fb          	endbr32 
  800af5:	55                   	push   %ebp
  800af6:	89 e5                	mov    %esp,%ebp
  800af8:	56                   	push   %esi
  800af9:	53                   	push   %ebx
  800afa:	8b 45 08             	mov    0x8(%ebp),%eax
  800afd:	8b 55 0c             	mov    0xc(%ebp),%edx
  800b00:	89 c6                	mov    %eax,%esi
  800b02:	03 75 10             	add    0x10(%ebp),%esi
	const uint8_t *s1 = (const uint8_t *) v1;
	const uint8_t *s2 = (const uint8_t *) v2;

	while (n-- > 0) {
  800b05:	39 f0                	cmp    %esi,%eax
  800b07:	74 1c                	je     800b25 <memcmp+0x34>
		if (*s1 != *s2)
  800b09:	0f b6 08             	movzbl (%eax),%ecx
  800b0c:	0f b6 1a             	movzbl (%edx),%ebx
  800b0f:	38 d9                	cmp    %bl,%cl
  800b11:	75 08                	jne    800b1b <memcmp+0x2a>
			return (int) *s1 - (int) *s2;
		s1++, s2++;
  800b13:	83 c0 01             	add    $0x1,%eax
  800b16:	83 c2 01             	add    $0x1,%edx
  800b19:	eb ea                	jmp    800b05 <memcmp+0x14>
			return (int) *s1 - (int) *s2;
  800b1b:	0f b6 c1             	movzbl %cl,%eax
  800b1e:	0f b6 db             	movzbl %bl,%ebx
  800b21:	29 d8                	sub    %ebx,%eax
  800b23:	eb 05                	jmp    800b2a <memcmp+0x39>
	}

	return 0;
  800b25:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800b2a:	5b                   	pop    %ebx
  800b2b:	5e                   	pop    %esi
  800b2c:	5d                   	pop    %ebp
  800b2d:	c3                   	ret    

00800b2e <memfind>:

void *
memfind(const void *s, int c, size_t n)
{
  800b2e:	f3 0f 1e fb          	endbr32 
  800b32:	55                   	push   %ebp
  800b33:	89 e5                	mov    %esp,%ebp
  800b35:	8b 45 08             	mov    0x8(%ebp),%eax
  800b38:	8b 4d 0c             	mov    0xc(%ebp),%ecx
	const void *ends = (const char *) s + n;
  800b3b:	89 c2                	mov    %eax,%edx
  800b3d:	03 55 10             	add    0x10(%ebp),%edx
	for (; s < ends; s++)
  800b40:	39 d0                	cmp    %edx,%eax
  800b42:	73 09                	jae    800b4d <memfind+0x1f>
		if (*(const unsigned char *) s == (unsigned char) c)
  800b44:	38 08                	cmp    %cl,(%eax)
  800b46:	74 05                	je     800b4d <memfind+0x1f>
	for (; s < ends; s++)
  800b48:	83 c0 01             	add    $0x1,%eax
  800b4b:	eb f3                	jmp    800b40 <memfind+0x12>
			break;
	return (void *) s;
}
  800b4d:	5d                   	pop    %ebp
  800b4e:	c3                   	ret    

00800b4f <strtol>:

long
strtol(const char *s, char **endptr, int base)
{
  800b4f:	f3 0f 1e fb          	endbr32 
  800b53:	55                   	push   %ebp
  800b54:	89 e5                	mov    %esp,%ebp
  800b56:	57                   	push   %edi
  800b57:	56                   	push   %esi
  800b58:	53                   	push   %ebx
  800b59:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800b5c:	8b 5d 10             	mov    0x10(%ebp),%ebx
	int neg = 0;
	long val = 0;

	// gobble initial whitespace
	while (*s == ' ' || *s == '\t')
  800b5f:	eb 03                	jmp    800b64 <strtol+0x15>
		s++;
  800b61:	83 c1 01             	add    $0x1,%ecx
	while (*s == ' ' || *s == '\t')
  800b64:	0f b6 01             	movzbl (%ecx),%eax
  800b67:	3c 20                	cmp    $0x20,%al
  800b69:	74 f6                	je     800b61 <strtol+0x12>
  800b6b:	3c 09                	cmp    $0x9,%al
  800b6d:	74 f2                	je     800b61 <strtol+0x12>

	// plus/minus sign
	if (*s == '+')
  800b6f:	3c 2b                	cmp    $0x2b,%al
  800b71:	74 2a                	je     800b9d <strtol+0x4e>
	int neg = 0;
  800b73:	bf 00 00 00 00       	mov    $0x0,%edi
		s++;
	else if (*s == '-')
  800b78:	3c 2d                	cmp    $0x2d,%al
  800b7a:	74 2b                	je     800ba7 <strtol+0x58>
		s++, neg = 1;

	// hex or octal base prefix
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800b7c:	f7 c3 ef ff ff ff    	test   $0xffffffef,%ebx
  800b82:	75 0f                	jne    800b93 <strtol+0x44>
  800b84:	80 39 30             	cmpb   $0x30,(%ecx)
  800b87:	74 28                	je     800bb1 <strtol+0x62>
		s += 2, base = 16;
	else if (base == 0 && s[0] == '0')
		s++, base = 8;
	else if (base == 0)
		base = 10;
  800b89:	85 db                	test   %ebx,%ebx
  800b8b:	b8 0a 00 00 00       	mov    $0xa,%eax
  800b90:	0f 44 d8             	cmove  %eax,%ebx
  800b93:	b8 00 00 00 00       	mov    $0x0,%eax
  800b98:	89 5d 10             	mov    %ebx,0x10(%ebp)
  800b9b:	eb 46                	jmp    800be3 <strtol+0x94>
		s++;
  800b9d:	83 c1 01             	add    $0x1,%ecx
	int neg = 0;
  800ba0:	bf 00 00 00 00       	mov    $0x0,%edi
  800ba5:	eb d5                	jmp    800b7c <strtol+0x2d>
		s++, neg = 1;
  800ba7:	83 c1 01             	add    $0x1,%ecx
  800baa:	bf 01 00 00 00       	mov    $0x1,%edi
  800baf:	eb cb                	jmp    800b7c <strtol+0x2d>
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800bb1:	80 79 01 78          	cmpb   $0x78,0x1(%ecx)
  800bb5:	74 0e                	je     800bc5 <strtol+0x76>
	else if (base == 0 && s[0] == '0')
  800bb7:	85 db                	test   %ebx,%ebx
  800bb9:	75 d8                	jne    800b93 <strtol+0x44>
		s++, base = 8;
  800bbb:	83 c1 01             	add    $0x1,%ecx
  800bbe:	bb 08 00 00 00       	mov    $0x8,%ebx
  800bc3:	eb ce                	jmp    800b93 <strtol+0x44>
		s += 2, base = 16;
  800bc5:	83 c1 02             	add    $0x2,%ecx
  800bc8:	bb 10 00 00 00       	mov    $0x10,%ebx
  800bcd:	eb c4                	jmp    800b93 <strtol+0x44>
	// digits
	while (1) {
		int dig;

		if (*s >= '0' && *s <= '9')
			dig = *s - '0';
  800bcf:	0f be d2             	movsbl %dl,%edx
  800bd2:	83 ea 30             	sub    $0x30,%edx
			dig = *s - 'a' + 10;
		else if (*s >= 'A' && *s <= 'Z')
			dig = *s - 'A' + 10;
		else
			break;
		if (dig >= base)
  800bd5:	3b 55 10             	cmp    0x10(%ebp),%edx
  800bd8:	7d 3a                	jge    800c14 <strtol+0xc5>
			break;
		s++, val = (val * base) + dig;
  800bda:	83 c1 01             	add    $0x1,%ecx
  800bdd:	0f af 45 10          	imul   0x10(%ebp),%eax
  800be1:	01 d0                	add    %edx,%eax
		if (*s >= '0' && *s <= '9')
  800be3:	0f b6 11             	movzbl (%ecx),%edx
  800be6:	8d 72 d0             	lea    -0x30(%edx),%esi
  800be9:	89 f3                	mov    %esi,%ebx
  800beb:	80 fb 09             	cmp    $0x9,%bl
  800bee:	76 df                	jbe    800bcf <strtol+0x80>
		else if (*s >= 'a' && *s <= 'z')
  800bf0:	8d 72 9f             	lea    -0x61(%edx),%esi
  800bf3:	89 f3                	mov    %esi,%ebx
  800bf5:	80 fb 19             	cmp    $0x19,%bl
  800bf8:	77 08                	ja     800c02 <strtol+0xb3>
			dig = *s - 'a' + 10;
  800bfa:	0f be d2             	movsbl %dl,%edx
  800bfd:	83 ea 57             	sub    $0x57,%edx
  800c00:	eb d3                	jmp    800bd5 <strtol+0x86>
		else if (*s >= 'A' && *s <= 'Z')
  800c02:	8d 72 bf             	lea    -0x41(%edx),%esi
  800c05:	89 f3                	mov    %esi,%ebx
  800c07:	80 fb 19             	cmp    $0x19,%bl
  800c0a:	77 08                	ja     800c14 <strtol+0xc5>
			dig = *s - 'A' + 10;
  800c0c:	0f be d2             	movsbl %dl,%edx
  800c0f:	83 ea 37             	sub    $0x37,%edx
  800c12:	eb c1                	jmp    800bd5 <strtol+0x86>
		// we don't properly detect overflow!
	}

	if (endptr)
  800c14:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  800c18:	74 05                	je     800c1f <strtol+0xd0>
		*endptr = (char *) s;
  800c1a:	8b 75 0c             	mov    0xc(%ebp),%esi
  800c1d:	89 0e                	mov    %ecx,(%esi)
	return (neg ? -val : val);
  800c1f:	89 c2                	mov    %eax,%edx
  800c21:	f7 da                	neg    %edx
  800c23:	85 ff                	test   %edi,%edi
  800c25:	0f 45 c2             	cmovne %edx,%eax
}
  800c28:	5b                   	pop    %ebx
  800c29:	5e                   	pop    %esi
  800c2a:	5f                   	pop    %edi
  800c2b:	5d                   	pop    %ebp
  800c2c:	c3                   	ret    

00800c2d <sys_cputs>:
	return ret;
}

void
sys_cputs(const char *s, size_t len)
{
  800c2d:	f3 0f 1e fb          	endbr32 
  800c31:	55                   	push   %ebp
  800c32:	89 e5                	mov    %esp,%ebp
  800c34:	57                   	push   %edi
  800c35:	56                   	push   %esi
  800c36:	53                   	push   %ebx
	asm volatile("int %1\n"
  800c37:	b8 00 00 00 00       	mov    $0x0,%eax
  800c3c:	8b 55 08             	mov    0x8(%ebp),%edx
  800c3f:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c42:	89 c3                	mov    %eax,%ebx
  800c44:	89 c7                	mov    %eax,%edi
  800c46:	89 c6                	mov    %eax,%esi
  800c48:	cd 30                	int    $0x30
	syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0);
}
  800c4a:	5b                   	pop    %ebx
  800c4b:	5e                   	pop    %esi
  800c4c:	5f                   	pop    %edi
  800c4d:	5d                   	pop    %ebp
  800c4e:	c3                   	ret    

00800c4f <sys_cgetc>:

int
sys_cgetc(void)
{
  800c4f:	f3 0f 1e fb          	endbr32 
  800c53:	55                   	push   %ebp
  800c54:	89 e5                	mov    %esp,%ebp
  800c56:	57                   	push   %edi
  800c57:	56                   	push   %esi
  800c58:	53                   	push   %ebx
	asm volatile("int %1\n"
  800c59:	ba 00 00 00 00       	mov    $0x0,%edx
  800c5e:	b8 01 00 00 00       	mov    $0x1,%eax
  800c63:	89 d1                	mov    %edx,%ecx
  800c65:	89 d3                	mov    %edx,%ebx
  800c67:	89 d7                	mov    %edx,%edi
  800c69:	89 d6                	mov    %edx,%esi
  800c6b:	cd 30                	int    $0x30
	return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0);
}
  800c6d:	5b                   	pop    %ebx
  800c6e:	5e                   	pop    %esi
  800c6f:	5f                   	pop    %edi
  800c70:	5d                   	pop    %ebp
  800c71:	c3                   	ret    

00800c72 <sys_env_destroy>:

int
sys_env_destroy(envid_t envid)
{
  800c72:	f3 0f 1e fb          	endbr32 
  800c76:	55                   	push   %ebp
  800c77:	89 e5                	mov    %esp,%ebp
  800c79:	57                   	push   %edi
  800c7a:	56                   	push   %esi
  800c7b:	53                   	push   %ebx
  800c7c:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800c7f:	b9 00 00 00 00       	mov    $0x0,%ecx
  800c84:	8b 55 08             	mov    0x8(%ebp),%edx
  800c87:	b8 03 00 00 00       	mov    $0x3,%eax
  800c8c:	89 cb                	mov    %ecx,%ebx
  800c8e:	89 cf                	mov    %ecx,%edi
  800c90:	89 ce                	mov    %ecx,%esi
  800c92:	cd 30                	int    $0x30
	if(check && ret > 0)
  800c94:	85 c0                	test   %eax,%eax
  800c96:	7f 08                	jg     800ca0 <sys_env_destroy+0x2e>
	return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0);
}
  800c98:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800c9b:	5b                   	pop    %ebx
  800c9c:	5e                   	pop    %esi
  800c9d:	5f                   	pop    %edi
  800c9e:	5d                   	pop    %ebp
  800c9f:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800ca0:	83 ec 0c             	sub    $0xc,%esp
  800ca3:	50                   	push   %eax
  800ca4:	6a 03                	push   $0x3
  800ca6:	68 bf 24 80 00       	push   $0x8024bf
  800cab:	6a 23                	push   $0x23
  800cad:	68 dc 24 80 00       	push   $0x8024dc
  800cb2:	e8 44 f5 ff ff       	call   8001fb <_panic>

00800cb7 <sys_getenvid>:

envid_t
sys_getenvid(void)
{
  800cb7:	f3 0f 1e fb          	endbr32 
  800cbb:	55                   	push   %ebp
  800cbc:	89 e5                	mov    %esp,%ebp
  800cbe:	57                   	push   %edi
  800cbf:	56                   	push   %esi
  800cc0:	53                   	push   %ebx
	asm volatile("int %1\n"
  800cc1:	ba 00 00 00 00       	mov    $0x0,%edx
  800cc6:	b8 02 00 00 00       	mov    $0x2,%eax
  800ccb:	89 d1                	mov    %edx,%ecx
  800ccd:	89 d3                	mov    %edx,%ebx
  800ccf:	89 d7                	mov    %edx,%edi
  800cd1:	89 d6                	mov    %edx,%esi
  800cd3:	cd 30                	int    $0x30
	 return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0);
}
  800cd5:	5b                   	pop    %ebx
  800cd6:	5e                   	pop    %esi
  800cd7:	5f                   	pop    %edi
  800cd8:	5d                   	pop    %ebp
  800cd9:	c3                   	ret    

00800cda <sys_yield>:

void
sys_yield(void)
{
  800cda:	f3 0f 1e fb          	endbr32 
  800cde:	55                   	push   %ebp
  800cdf:	89 e5                	mov    %esp,%ebp
  800ce1:	57                   	push   %edi
  800ce2:	56                   	push   %esi
  800ce3:	53                   	push   %ebx
	asm volatile("int %1\n"
  800ce4:	ba 00 00 00 00       	mov    $0x0,%edx
  800ce9:	b8 0b 00 00 00       	mov    $0xb,%eax
  800cee:	89 d1                	mov    %edx,%ecx
  800cf0:	89 d3                	mov    %edx,%ebx
  800cf2:	89 d7                	mov    %edx,%edi
  800cf4:	89 d6                	mov    %edx,%esi
  800cf6:	cd 30                	int    $0x30
	syscall(SYS_yield, 0, 0, 0, 0, 0, 0);
}
  800cf8:	5b                   	pop    %ebx
  800cf9:	5e                   	pop    %esi
  800cfa:	5f                   	pop    %edi
  800cfb:	5d                   	pop    %ebp
  800cfc:	c3                   	ret    

00800cfd <sys_page_alloc>:

int
sys_page_alloc(envid_t envid, void *va, int perm)
{
  800cfd:	f3 0f 1e fb          	endbr32 
  800d01:	55                   	push   %ebp
  800d02:	89 e5                	mov    %esp,%ebp
  800d04:	57                   	push   %edi
  800d05:	56                   	push   %esi
  800d06:	53                   	push   %ebx
  800d07:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d0a:	be 00 00 00 00       	mov    $0x0,%esi
  800d0f:	8b 55 08             	mov    0x8(%ebp),%edx
  800d12:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d15:	b8 04 00 00 00       	mov    $0x4,%eax
  800d1a:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800d1d:	89 f7                	mov    %esi,%edi
  800d1f:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d21:	85 c0                	test   %eax,%eax
  800d23:	7f 08                	jg     800d2d <sys_page_alloc+0x30>
	return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0);
}
  800d25:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d28:	5b                   	pop    %ebx
  800d29:	5e                   	pop    %esi
  800d2a:	5f                   	pop    %edi
  800d2b:	5d                   	pop    %ebp
  800d2c:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d2d:	83 ec 0c             	sub    $0xc,%esp
  800d30:	50                   	push   %eax
  800d31:	6a 04                	push   $0x4
  800d33:	68 bf 24 80 00       	push   $0x8024bf
  800d38:	6a 23                	push   $0x23
  800d3a:	68 dc 24 80 00       	push   $0x8024dc
  800d3f:	e8 b7 f4 ff ff       	call   8001fb <_panic>

00800d44 <sys_page_map>:

int
sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm)
{
  800d44:	f3 0f 1e fb          	endbr32 
  800d48:	55                   	push   %ebp
  800d49:	89 e5                	mov    %esp,%ebp
  800d4b:	57                   	push   %edi
  800d4c:	56                   	push   %esi
  800d4d:	53                   	push   %ebx
  800d4e:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d51:	8b 55 08             	mov    0x8(%ebp),%edx
  800d54:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d57:	b8 05 00 00 00       	mov    $0x5,%eax
  800d5c:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800d5f:	8b 7d 14             	mov    0x14(%ebp),%edi
  800d62:	8b 75 18             	mov    0x18(%ebp),%esi
  800d65:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d67:	85 c0                	test   %eax,%eax
  800d69:	7f 08                	jg     800d73 <sys_page_map+0x2f>
	return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm);
}
  800d6b:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d6e:	5b                   	pop    %ebx
  800d6f:	5e                   	pop    %esi
  800d70:	5f                   	pop    %edi
  800d71:	5d                   	pop    %ebp
  800d72:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d73:	83 ec 0c             	sub    $0xc,%esp
  800d76:	50                   	push   %eax
  800d77:	6a 05                	push   $0x5
  800d79:	68 bf 24 80 00       	push   $0x8024bf
  800d7e:	6a 23                	push   $0x23
  800d80:	68 dc 24 80 00       	push   $0x8024dc
  800d85:	e8 71 f4 ff ff       	call   8001fb <_panic>

00800d8a <sys_page_unmap>:

int
sys_page_unmap(envid_t envid, void *va)
{
  800d8a:	f3 0f 1e fb          	endbr32 
  800d8e:	55                   	push   %ebp
  800d8f:	89 e5                	mov    %esp,%ebp
  800d91:	57                   	push   %edi
  800d92:	56                   	push   %esi
  800d93:	53                   	push   %ebx
  800d94:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d97:	bb 00 00 00 00       	mov    $0x0,%ebx
  800d9c:	8b 55 08             	mov    0x8(%ebp),%edx
  800d9f:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800da2:	b8 06 00 00 00       	mov    $0x6,%eax
  800da7:	89 df                	mov    %ebx,%edi
  800da9:	89 de                	mov    %ebx,%esi
  800dab:	cd 30                	int    $0x30
	if(check && ret > 0)
  800dad:	85 c0                	test   %eax,%eax
  800daf:	7f 08                	jg     800db9 <sys_page_unmap+0x2f>
	return syscall(SYS_page_unmap, 1, envid, (uint32_t) va, 0, 0, 0);
}
  800db1:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800db4:	5b                   	pop    %ebx
  800db5:	5e                   	pop    %esi
  800db6:	5f                   	pop    %edi
  800db7:	5d                   	pop    %ebp
  800db8:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800db9:	83 ec 0c             	sub    $0xc,%esp
  800dbc:	50                   	push   %eax
  800dbd:	6a 06                	push   $0x6
  800dbf:	68 bf 24 80 00       	push   $0x8024bf
  800dc4:	6a 23                	push   $0x23
  800dc6:	68 dc 24 80 00       	push   $0x8024dc
  800dcb:	e8 2b f4 ff ff       	call   8001fb <_panic>

00800dd0 <sys_env_set_status>:

// sys_exofork is inlined in lib.h

int
sys_env_set_status(envid_t envid, int status)
{
  800dd0:	f3 0f 1e fb          	endbr32 
  800dd4:	55                   	push   %ebp
  800dd5:	89 e5                	mov    %esp,%ebp
  800dd7:	57                   	push   %edi
  800dd8:	56                   	push   %esi
  800dd9:	53                   	push   %ebx
  800dda:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800ddd:	bb 00 00 00 00       	mov    $0x0,%ebx
  800de2:	8b 55 08             	mov    0x8(%ebp),%edx
  800de5:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800de8:	b8 08 00 00 00       	mov    $0x8,%eax
  800ded:	89 df                	mov    %ebx,%edi
  800def:	89 de                	mov    %ebx,%esi
  800df1:	cd 30                	int    $0x30
	if(check && ret > 0)
  800df3:	85 c0                	test   %eax,%eax
  800df5:	7f 08                	jg     800dff <sys_env_set_status+0x2f>
	return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0);
}
  800df7:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800dfa:	5b                   	pop    %ebx
  800dfb:	5e                   	pop    %esi
  800dfc:	5f                   	pop    %edi
  800dfd:	5d                   	pop    %ebp
  800dfe:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800dff:	83 ec 0c             	sub    $0xc,%esp
  800e02:	50                   	push   %eax
  800e03:	6a 08                	push   $0x8
  800e05:	68 bf 24 80 00       	push   $0x8024bf
  800e0a:	6a 23                	push   $0x23
  800e0c:	68 dc 24 80 00       	push   $0x8024dc
  800e11:	e8 e5 f3 ff ff       	call   8001fb <_panic>

00800e16 <sys_env_set_trapframe>:

int
sys_env_set_trapframe(envid_t envid, struct Trapframe *tf)
{
  800e16:	f3 0f 1e fb          	endbr32 
  800e1a:	55                   	push   %ebp
  800e1b:	89 e5                	mov    %esp,%ebp
  800e1d:	57                   	push   %edi
  800e1e:	56                   	push   %esi
  800e1f:	53                   	push   %ebx
  800e20:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800e23:	bb 00 00 00 00       	mov    $0x0,%ebx
  800e28:	8b 55 08             	mov    0x8(%ebp),%edx
  800e2b:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800e2e:	b8 09 00 00 00       	mov    $0x9,%eax
  800e33:	89 df                	mov    %ebx,%edi
  800e35:	89 de                	mov    %ebx,%esi
  800e37:	cd 30                	int    $0x30
	if(check && ret > 0)
  800e39:	85 c0                	test   %eax,%eax
  800e3b:	7f 08                	jg     800e45 <sys_env_set_trapframe+0x2f>
	return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0);
}
  800e3d:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800e40:	5b                   	pop    %ebx
  800e41:	5e                   	pop    %esi
  800e42:	5f                   	pop    %edi
  800e43:	5d                   	pop    %ebp
  800e44:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800e45:	83 ec 0c             	sub    $0xc,%esp
  800e48:	50                   	push   %eax
  800e49:	6a 09                	push   $0x9
  800e4b:	68 bf 24 80 00       	push   $0x8024bf
  800e50:	6a 23                	push   $0x23
  800e52:	68 dc 24 80 00       	push   $0x8024dc
  800e57:	e8 9f f3 ff ff       	call   8001fb <_panic>

00800e5c <sys_env_set_pgfault_upcall>:

int
sys_env_set_pgfault_upcall(envid_t envid, void *upcall)
{
  800e5c:	f3 0f 1e fb          	endbr32 
  800e60:	55                   	push   %ebp
  800e61:	89 e5                	mov    %esp,%ebp
  800e63:	57                   	push   %edi
  800e64:	56                   	push   %esi
  800e65:	53                   	push   %ebx
  800e66:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800e69:	bb 00 00 00 00       	mov    $0x0,%ebx
  800e6e:	8b 55 08             	mov    0x8(%ebp),%edx
  800e71:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800e74:	b8 0a 00 00 00       	mov    $0xa,%eax
  800e79:	89 df                	mov    %ebx,%edi
  800e7b:	89 de                	mov    %ebx,%esi
  800e7d:	cd 30                	int    $0x30
	if(check && ret > 0)
  800e7f:	85 c0                	test   %eax,%eax
  800e81:	7f 08                	jg     800e8b <sys_env_set_pgfault_upcall+0x2f>
	return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0);
}
  800e83:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800e86:	5b                   	pop    %ebx
  800e87:	5e                   	pop    %esi
  800e88:	5f                   	pop    %edi
  800e89:	5d                   	pop    %ebp
  800e8a:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800e8b:	83 ec 0c             	sub    $0xc,%esp
  800e8e:	50                   	push   %eax
  800e8f:	6a 0a                	push   $0xa
  800e91:	68 bf 24 80 00       	push   $0x8024bf
  800e96:	6a 23                	push   $0x23
  800e98:	68 dc 24 80 00       	push   $0x8024dc
  800e9d:	e8 59 f3 ff ff       	call   8001fb <_panic>

00800ea2 <sys_ipc_try_send>:

int
sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm)
{
  800ea2:	f3 0f 1e fb          	endbr32 
  800ea6:	55                   	push   %ebp
  800ea7:	89 e5                	mov    %esp,%ebp
  800ea9:	57                   	push   %edi
  800eaa:	56                   	push   %esi
  800eab:	53                   	push   %ebx
	asm volatile("int %1\n"
  800eac:	8b 55 08             	mov    0x8(%ebp),%edx
  800eaf:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800eb2:	b8 0c 00 00 00       	mov    $0xc,%eax
  800eb7:	be 00 00 00 00       	mov    $0x0,%esi
  800ebc:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800ebf:	8b 7d 14             	mov    0x14(%ebp),%edi
  800ec2:	cd 30                	int    $0x30
	return syscall(SYS_ipc_try_send, 0, envid, value, (uint32_t) srcva, perm, 0);
}
  800ec4:	5b                   	pop    %ebx
  800ec5:	5e                   	pop    %esi
  800ec6:	5f                   	pop    %edi
  800ec7:	5d                   	pop    %ebp
  800ec8:	c3                   	ret    

00800ec9 <sys_ipc_recv>:

int
sys_ipc_recv(void *dstva)
{
  800ec9:	f3 0f 1e fb          	endbr32 
  800ecd:	55                   	push   %ebp
  800ece:	89 e5                	mov    %esp,%ebp
  800ed0:	57                   	push   %edi
  800ed1:	56                   	push   %esi
  800ed2:	53                   	push   %ebx
  800ed3:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800ed6:	b9 00 00 00 00       	mov    $0x0,%ecx
  800edb:	8b 55 08             	mov    0x8(%ebp),%edx
  800ede:	b8 0d 00 00 00       	mov    $0xd,%eax
  800ee3:	89 cb                	mov    %ecx,%ebx
  800ee5:	89 cf                	mov    %ecx,%edi
  800ee7:	89 ce                	mov    %ecx,%esi
  800ee9:	cd 30                	int    $0x30
	if(check && ret > 0)
  800eeb:	85 c0                	test   %eax,%eax
  800eed:	7f 08                	jg     800ef7 <sys_ipc_recv+0x2e>
	return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0);
}
  800eef:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800ef2:	5b                   	pop    %ebx
  800ef3:	5e                   	pop    %esi
  800ef4:	5f                   	pop    %edi
  800ef5:	5d                   	pop    %ebp
  800ef6:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800ef7:	83 ec 0c             	sub    $0xc,%esp
  800efa:	50                   	push   %eax
  800efb:	6a 0d                	push   $0xd
  800efd:	68 bf 24 80 00       	push   $0x8024bf
  800f02:	6a 23                	push   $0x23
  800f04:	68 dc 24 80 00       	push   $0x8024dc
  800f09:	e8 ed f2 ff ff       	call   8001fb <_panic>

00800f0e <fd2num>:
// File descriptor manipulators
// --------------------------------------------------------------

int
fd2num(struct Fd *fd)
{
  800f0e:	f3 0f 1e fb          	endbr32 
  800f12:	55                   	push   %ebp
  800f13:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  800f15:	8b 45 08             	mov    0x8(%ebp),%eax
  800f18:	05 00 00 00 30       	add    $0x30000000,%eax
  800f1d:	c1 e8 0c             	shr    $0xc,%eax
}
  800f20:	5d                   	pop    %ebp
  800f21:	c3                   	ret    

00800f22 <fd2data>:

char*
fd2data(struct Fd *fd)
{
  800f22:	f3 0f 1e fb          	endbr32 
  800f26:	55                   	push   %ebp
  800f27:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  800f29:	8b 45 08             	mov    0x8(%ebp),%eax
  800f2c:	05 00 00 00 30       	add    $0x30000000,%eax
	return INDEX2DATA(fd2num(fd));
  800f31:	25 00 f0 ff ff       	and    $0xfffff000,%eax
  800f36:	2d 00 00 fe 2f       	sub    $0x2ffe0000,%eax
}
  800f3b:	5d                   	pop    %ebp
  800f3c:	c3                   	ret    

00800f3d <fd_alloc>:
// Returns 0 on success, < 0 on error.  Errors are:
//	-E_MAX_FD: no more file descriptors
// On error, *fd_store is set to 0.
int
fd_alloc(struct Fd **fd_store)
{
  800f3d:	f3 0f 1e fb          	endbr32 
  800f41:	55                   	push   %ebp
  800f42:	89 e5                	mov    %esp,%ebp
  800f44:	b8 00 00 00 d0       	mov    $0xd0000000,%eax
	int i;
	struct Fd *fd;

	for (i = 0; i < MAXFD; i++) {
		fd = INDEX2FD(i);
		if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) {
  800f49:	89 c2                	mov    %eax,%edx
  800f4b:	c1 ea 16             	shr    $0x16,%edx
  800f4e:	8b 14 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%edx
  800f55:	f6 c2 01             	test   $0x1,%dl
  800f58:	74 2d                	je     800f87 <fd_alloc+0x4a>
  800f5a:	89 c2                	mov    %eax,%edx
  800f5c:	c1 ea 0c             	shr    $0xc,%edx
  800f5f:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  800f66:	f6 c2 01             	test   $0x1,%dl
  800f69:	74 1c                	je     800f87 <fd_alloc+0x4a>
  800f6b:	05 00 10 00 00       	add    $0x1000,%eax
	for (i = 0; i < MAXFD; i++) {
  800f70:	3d 00 00 02 d0       	cmp    $0xd0020000,%eax
  800f75:	75 d2                	jne    800f49 <fd_alloc+0xc>
			*fd_store = fd;
			return 0;
		}
	}
	*fd_store = 0;
  800f77:	8b 45 08             	mov    0x8(%ebp),%eax
  800f7a:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_MAX_OPEN;
  800f80:	b8 f6 ff ff ff       	mov    $0xfffffff6,%eax
  800f85:	eb 0a                	jmp    800f91 <fd_alloc+0x54>
			*fd_store = fd;
  800f87:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800f8a:	89 01                	mov    %eax,(%ecx)
			return 0;
  800f8c:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800f91:	5d                   	pop    %ebp
  800f92:	c3                   	ret    

00800f93 <fd_lookup>:
// Returns 0 on success (the page is in range and mapped), < 0 on error.
// Errors are:
//	-E_INVAL: fdnum was either not in range or not mapped.
int
fd_lookup(int fdnum, struct Fd **fd_store)
{
  800f93:	f3 0f 1e fb          	endbr32 
  800f97:	55                   	push   %ebp
  800f98:	89 e5                	mov    %esp,%ebp
  800f9a:	8b 45 08             	mov    0x8(%ebp),%eax
	struct Fd *fd;

	if (fdnum < 0 || fdnum >= MAXFD) {
  800f9d:	83 f8 1f             	cmp    $0x1f,%eax
  800fa0:	77 30                	ja     800fd2 <fd_lookup+0x3f>
		if (debug)
			cprintf("[%08x] bad fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	fd = INDEX2FD(fdnum);
  800fa2:	c1 e0 0c             	shl    $0xc,%eax
  800fa5:	2d 00 00 00 30       	sub    $0x30000000,%eax
	if (!(uvpd[PDX(fd)] & PTE_P) || !(uvpt[PGNUM(fd)] & PTE_P)) {
  800faa:	8b 15 00 dd 7b ef    	mov    0xef7bdd00,%edx
  800fb0:	f6 c2 01             	test   $0x1,%dl
  800fb3:	74 24                	je     800fd9 <fd_lookup+0x46>
  800fb5:	89 c2                	mov    %eax,%edx
  800fb7:	c1 ea 0c             	shr    $0xc,%edx
  800fba:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  800fc1:	f6 c2 01             	test   $0x1,%dl
  800fc4:	74 1a                	je     800fe0 <fd_lookup+0x4d>
		if (debug)
			cprintf("[%08x] closed fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	*fd_store = fd;
  800fc6:	8b 55 0c             	mov    0xc(%ebp),%edx
  800fc9:	89 02                	mov    %eax,(%edx)
	return 0;
  800fcb:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800fd0:	5d                   	pop    %ebp
  800fd1:	c3                   	ret    
		return -E_INVAL;
  800fd2:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  800fd7:	eb f7                	jmp    800fd0 <fd_lookup+0x3d>
		return -E_INVAL;
  800fd9:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  800fde:	eb f0                	jmp    800fd0 <fd_lookup+0x3d>
  800fe0:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  800fe5:	eb e9                	jmp    800fd0 <fd_lookup+0x3d>

00800fe7 <dev_lookup>:
	0
};

int
dev_lookup(int dev_id, struct Dev **dev)
{
  800fe7:	f3 0f 1e fb          	endbr32 
  800feb:	55                   	push   %ebp
  800fec:	89 e5                	mov    %esp,%ebp
  800fee:	83 ec 08             	sub    $0x8,%esp
  800ff1:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800ff4:	ba 68 25 80 00       	mov    $0x802568,%edx
	int i;
	for (i = 0; devtab[i]; i++)
  800ff9:	b8 08 30 80 00       	mov    $0x803008,%eax
		if (devtab[i]->dev_id == dev_id) {
  800ffe:	39 08                	cmp    %ecx,(%eax)
  801000:	74 33                	je     801035 <dev_lookup+0x4e>
  801002:	83 c2 04             	add    $0x4,%edx
	for (i = 0; devtab[i]; i++)
  801005:	8b 02                	mov    (%edx),%eax
  801007:	85 c0                	test   %eax,%eax
  801009:	75 f3                	jne    800ffe <dev_lookup+0x17>
			*dev = devtab[i];
			return 0;
		}
	cprintf("[%08x] unknown device type %d\n", thisenv->env_id, dev_id);
  80100b:	a1 08 40 80 00       	mov    0x804008,%eax
  801010:	8b 40 48             	mov    0x48(%eax),%eax
  801013:	83 ec 04             	sub    $0x4,%esp
  801016:	51                   	push   %ecx
  801017:	50                   	push   %eax
  801018:	68 ec 24 80 00       	push   $0x8024ec
  80101d:	e8 c0 f2 ff ff       	call   8002e2 <cprintf>
	*dev = 0;
  801022:	8b 45 0c             	mov    0xc(%ebp),%eax
  801025:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_INVAL;
  80102b:	83 c4 10             	add    $0x10,%esp
  80102e:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
}
  801033:	c9                   	leave  
  801034:	c3                   	ret    
			*dev = devtab[i];
  801035:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801038:	89 01                	mov    %eax,(%ecx)
			return 0;
  80103a:	b8 00 00 00 00       	mov    $0x0,%eax
  80103f:	eb f2                	jmp    801033 <dev_lookup+0x4c>

00801041 <fd_close>:
{
  801041:	f3 0f 1e fb          	endbr32 
  801045:	55                   	push   %ebp
  801046:	89 e5                	mov    %esp,%ebp
  801048:	57                   	push   %edi
  801049:	56                   	push   %esi
  80104a:	53                   	push   %ebx
  80104b:	83 ec 24             	sub    $0x24,%esp
  80104e:	8b 75 08             	mov    0x8(%ebp),%esi
  801051:	8b 7d 0c             	mov    0xc(%ebp),%edi
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  801054:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  801057:	50                   	push   %eax
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  801058:	8d 86 00 00 00 30    	lea    0x30000000(%esi),%eax
  80105e:	c1 e8 0c             	shr    $0xc,%eax
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  801061:	50                   	push   %eax
  801062:	e8 2c ff ff ff       	call   800f93 <fd_lookup>
  801067:	89 c3                	mov    %eax,%ebx
  801069:	83 c4 10             	add    $0x10,%esp
  80106c:	85 c0                	test   %eax,%eax
  80106e:	78 05                	js     801075 <fd_close+0x34>
	    || fd != fd2)
  801070:	39 75 e4             	cmp    %esi,-0x1c(%ebp)
  801073:	74 16                	je     80108b <fd_close+0x4a>
		return (must_exist ? r : 0);
  801075:	89 f8                	mov    %edi,%eax
  801077:	84 c0                	test   %al,%al
  801079:	b8 00 00 00 00       	mov    $0x0,%eax
  80107e:	0f 44 d8             	cmove  %eax,%ebx
}
  801081:	89 d8                	mov    %ebx,%eax
  801083:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801086:	5b                   	pop    %ebx
  801087:	5e                   	pop    %esi
  801088:	5f                   	pop    %edi
  801089:	5d                   	pop    %ebp
  80108a:	c3                   	ret    
	if ((r = dev_lookup(fd->fd_dev_id, &dev)) >= 0) {
  80108b:	83 ec 08             	sub    $0x8,%esp
  80108e:	8d 45 e0             	lea    -0x20(%ebp),%eax
  801091:	50                   	push   %eax
  801092:	ff 36                	pushl  (%esi)
  801094:	e8 4e ff ff ff       	call   800fe7 <dev_lookup>
  801099:	89 c3                	mov    %eax,%ebx
  80109b:	83 c4 10             	add    $0x10,%esp
  80109e:	85 c0                	test   %eax,%eax
  8010a0:	78 1a                	js     8010bc <fd_close+0x7b>
		if (dev->dev_close)
  8010a2:	8b 45 e0             	mov    -0x20(%ebp),%eax
  8010a5:	8b 40 10             	mov    0x10(%eax),%eax
			r = 0;
  8010a8:	bb 00 00 00 00       	mov    $0x0,%ebx
		if (dev->dev_close)
  8010ad:	85 c0                	test   %eax,%eax
  8010af:	74 0b                	je     8010bc <fd_close+0x7b>
			r = (*dev->dev_close)(fd);
  8010b1:	83 ec 0c             	sub    $0xc,%esp
  8010b4:	56                   	push   %esi
  8010b5:	ff d0                	call   *%eax
  8010b7:	89 c3                	mov    %eax,%ebx
  8010b9:	83 c4 10             	add    $0x10,%esp
	(void) sys_page_unmap(0, fd);
  8010bc:	83 ec 08             	sub    $0x8,%esp
  8010bf:	56                   	push   %esi
  8010c0:	6a 00                	push   $0x0
  8010c2:	e8 c3 fc ff ff       	call   800d8a <sys_page_unmap>
	return r;
  8010c7:	83 c4 10             	add    $0x10,%esp
  8010ca:	eb b5                	jmp    801081 <fd_close+0x40>

008010cc <close>:

int
close(int fdnum)
{
  8010cc:	f3 0f 1e fb          	endbr32 
  8010d0:	55                   	push   %ebp
  8010d1:	89 e5                	mov    %esp,%ebp
  8010d3:	83 ec 20             	sub    $0x20,%esp
	struct Fd *fd;
	int r;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  8010d6:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8010d9:	50                   	push   %eax
  8010da:	ff 75 08             	pushl  0x8(%ebp)
  8010dd:	e8 b1 fe ff ff       	call   800f93 <fd_lookup>
  8010e2:	83 c4 10             	add    $0x10,%esp
  8010e5:	85 c0                	test   %eax,%eax
  8010e7:	79 02                	jns    8010eb <close+0x1f>
		return r;
	else
		return fd_close(fd, 1);
}
  8010e9:	c9                   	leave  
  8010ea:	c3                   	ret    
		return fd_close(fd, 1);
  8010eb:	83 ec 08             	sub    $0x8,%esp
  8010ee:	6a 01                	push   $0x1
  8010f0:	ff 75 f4             	pushl  -0xc(%ebp)
  8010f3:	e8 49 ff ff ff       	call   801041 <fd_close>
  8010f8:	83 c4 10             	add    $0x10,%esp
  8010fb:	eb ec                	jmp    8010e9 <close+0x1d>

008010fd <close_all>:

void
close_all(void)
{
  8010fd:	f3 0f 1e fb          	endbr32 
  801101:	55                   	push   %ebp
  801102:	89 e5                	mov    %esp,%ebp
  801104:	53                   	push   %ebx
  801105:	83 ec 04             	sub    $0x4,%esp
	int i;
	for (i = 0; i < MAXFD; i++)
  801108:	bb 00 00 00 00       	mov    $0x0,%ebx
		close(i);
  80110d:	83 ec 0c             	sub    $0xc,%esp
  801110:	53                   	push   %ebx
  801111:	e8 b6 ff ff ff       	call   8010cc <close>
	for (i = 0; i < MAXFD; i++)
  801116:	83 c3 01             	add    $0x1,%ebx
  801119:	83 c4 10             	add    $0x10,%esp
  80111c:	83 fb 20             	cmp    $0x20,%ebx
  80111f:	75 ec                	jne    80110d <close_all+0x10>
}
  801121:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801124:	c9                   	leave  
  801125:	c3                   	ret    

00801126 <dup>:
// file and the file offset of the other.
// Closes any previously open file descriptor at 'newfdnum'.
// This is implemented using virtual memory tricks (of course!).
int
dup(int oldfdnum, int newfdnum)
{
  801126:	f3 0f 1e fb          	endbr32 
  80112a:	55                   	push   %ebp
  80112b:	89 e5                	mov    %esp,%ebp
  80112d:	57                   	push   %edi
  80112e:	56                   	push   %esi
  80112f:	53                   	push   %ebx
  801130:	83 ec 24             	sub    $0x24,%esp
	int r;
	char *ova, *nva;
	pte_t pte;
	struct Fd *oldfd, *newfd;

	if ((r = fd_lookup(oldfdnum, &oldfd)) < 0)
  801133:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  801136:	50                   	push   %eax
  801137:	ff 75 08             	pushl  0x8(%ebp)
  80113a:	e8 54 fe ff ff       	call   800f93 <fd_lookup>
  80113f:	89 c3                	mov    %eax,%ebx
  801141:	83 c4 10             	add    $0x10,%esp
  801144:	85 c0                	test   %eax,%eax
  801146:	0f 88 81 00 00 00    	js     8011cd <dup+0xa7>
		return r;
	close(newfdnum);
  80114c:	83 ec 0c             	sub    $0xc,%esp
  80114f:	ff 75 0c             	pushl  0xc(%ebp)
  801152:	e8 75 ff ff ff       	call   8010cc <close>

	newfd = INDEX2FD(newfdnum);
  801157:	8b 75 0c             	mov    0xc(%ebp),%esi
  80115a:	c1 e6 0c             	shl    $0xc,%esi
  80115d:	81 ee 00 00 00 30    	sub    $0x30000000,%esi
	ova = fd2data(oldfd);
  801163:	83 c4 04             	add    $0x4,%esp
  801166:	ff 75 e4             	pushl  -0x1c(%ebp)
  801169:	e8 b4 fd ff ff       	call   800f22 <fd2data>
  80116e:	89 c3                	mov    %eax,%ebx
	nva = fd2data(newfd);
  801170:	89 34 24             	mov    %esi,(%esp)
  801173:	e8 aa fd ff ff       	call   800f22 <fd2data>
  801178:	83 c4 10             	add    $0x10,%esp
  80117b:	89 c7                	mov    %eax,%edi

	if ((uvpd[PDX(ova)] & PTE_P) && (uvpt[PGNUM(ova)] & PTE_P))
  80117d:	89 d8                	mov    %ebx,%eax
  80117f:	c1 e8 16             	shr    $0x16,%eax
  801182:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  801189:	a8 01                	test   $0x1,%al
  80118b:	74 11                	je     80119e <dup+0x78>
  80118d:	89 d8                	mov    %ebx,%eax
  80118f:	c1 e8 0c             	shr    $0xc,%eax
  801192:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  801199:	f6 c2 01             	test   $0x1,%dl
  80119c:	75 39                	jne    8011d7 <dup+0xb1>
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
			goto err;
	if ((r = sys_page_map(0, oldfd, 0, newfd, uvpt[PGNUM(oldfd)] & PTE_SYSCALL)) < 0)
  80119e:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  8011a1:	89 d0                	mov    %edx,%eax
  8011a3:	c1 e8 0c             	shr    $0xc,%eax
  8011a6:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  8011ad:	83 ec 0c             	sub    $0xc,%esp
  8011b0:	25 07 0e 00 00       	and    $0xe07,%eax
  8011b5:	50                   	push   %eax
  8011b6:	56                   	push   %esi
  8011b7:	6a 00                	push   $0x0
  8011b9:	52                   	push   %edx
  8011ba:	6a 00                	push   $0x0
  8011bc:	e8 83 fb ff ff       	call   800d44 <sys_page_map>
  8011c1:	89 c3                	mov    %eax,%ebx
  8011c3:	83 c4 20             	add    $0x20,%esp
  8011c6:	85 c0                	test   %eax,%eax
  8011c8:	78 31                	js     8011fb <dup+0xd5>
		goto err;

	return newfdnum;
  8011ca:	8b 5d 0c             	mov    0xc(%ebp),%ebx

err:
	sys_page_unmap(0, newfd);
	sys_page_unmap(0, nva);
	return r;
}
  8011cd:	89 d8                	mov    %ebx,%eax
  8011cf:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8011d2:	5b                   	pop    %ebx
  8011d3:	5e                   	pop    %esi
  8011d4:	5f                   	pop    %edi
  8011d5:	5d                   	pop    %ebp
  8011d6:	c3                   	ret    
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
  8011d7:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  8011de:	83 ec 0c             	sub    $0xc,%esp
  8011e1:	25 07 0e 00 00       	and    $0xe07,%eax
  8011e6:	50                   	push   %eax
  8011e7:	57                   	push   %edi
  8011e8:	6a 00                	push   $0x0
  8011ea:	53                   	push   %ebx
  8011eb:	6a 00                	push   $0x0
  8011ed:	e8 52 fb ff ff       	call   800d44 <sys_page_map>
  8011f2:	89 c3                	mov    %eax,%ebx
  8011f4:	83 c4 20             	add    $0x20,%esp
  8011f7:	85 c0                	test   %eax,%eax
  8011f9:	79 a3                	jns    80119e <dup+0x78>
	sys_page_unmap(0, newfd);
  8011fb:	83 ec 08             	sub    $0x8,%esp
  8011fe:	56                   	push   %esi
  8011ff:	6a 00                	push   $0x0
  801201:	e8 84 fb ff ff       	call   800d8a <sys_page_unmap>
	sys_page_unmap(0, nva);
  801206:	83 c4 08             	add    $0x8,%esp
  801209:	57                   	push   %edi
  80120a:	6a 00                	push   $0x0
  80120c:	e8 79 fb ff ff       	call   800d8a <sys_page_unmap>
	return r;
  801211:	83 c4 10             	add    $0x10,%esp
  801214:	eb b7                	jmp    8011cd <dup+0xa7>

00801216 <read>:

ssize_t
read(int fdnum, void *buf, size_t n)
{
  801216:	f3 0f 1e fb          	endbr32 
  80121a:	55                   	push   %ebp
  80121b:	89 e5                	mov    %esp,%ebp
  80121d:	53                   	push   %ebx
  80121e:	83 ec 1c             	sub    $0x1c,%esp
  801221:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801224:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801227:	50                   	push   %eax
  801228:	53                   	push   %ebx
  801229:	e8 65 fd ff ff       	call   800f93 <fd_lookup>
  80122e:	83 c4 10             	add    $0x10,%esp
  801231:	85 c0                	test   %eax,%eax
  801233:	78 3f                	js     801274 <read+0x5e>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801235:	83 ec 08             	sub    $0x8,%esp
  801238:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80123b:	50                   	push   %eax
  80123c:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80123f:	ff 30                	pushl  (%eax)
  801241:	e8 a1 fd ff ff       	call   800fe7 <dev_lookup>
  801246:	83 c4 10             	add    $0x10,%esp
  801249:	85 c0                	test   %eax,%eax
  80124b:	78 27                	js     801274 <read+0x5e>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_WRONLY) {
  80124d:	8b 55 f0             	mov    -0x10(%ebp),%edx
  801250:	8b 42 08             	mov    0x8(%edx),%eax
  801253:	83 e0 03             	and    $0x3,%eax
  801256:	83 f8 01             	cmp    $0x1,%eax
  801259:	74 1e                	je     801279 <read+0x63>
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_read)
  80125b:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80125e:	8b 40 08             	mov    0x8(%eax),%eax
  801261:	85 c0                	test   %eax,%eax
  801263:	74 35                	je     80129a <read+0x84>
		return -E_NOT_SUPP;
	return (*dev->dev_read)(fd, buf, n);
  801265:	83 ec 04             	sub    $0x4,%esp
  801268:	ff 75 10             	pushl  0x10(%ebp)
  80126b:	ff 75 0c             	pushl  0xc(%ebp)
  80126e:	52                   	push   %edx
  80126f:	ff d0                	call   *%eax
  801271:	83 c4 10             	add    $0x10,%esp
}
  801274:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801277:	c9                   	leave  
  801278:	c3                   	ret    
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
  801279:	a1 08 40 80 00       	mov    0x804008,%eax
  80127e:	8b 40 48             	mov    0x48(%eax),%eax
  801281:	83 ec 04             	sub    $0x4,%esp
  801284:	53                   	push   %ebx
  801285:	50                   	push   %eax
  801286:	68 2d 25 80 00       	push   $0x80252d
  80128b:	e8 52 f0 ff ff       	call   8002e2 <cprintf>
		return -E_INVAL;
  801290:	83 c4 10             	add    $0x10,%esp
  801293:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801298:	eb da                	jmp    801274 <read+0x5e>
		return -E_NOT_SUPP;
  80129a:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  80129f:	eb d3                	jmp    801274 <read+0x5e>

008012a1 <readn>:

ssize_t
readn(int fdnum, void *buf, size_t n)
{
  8012a1:	f3 0f 1e fb          	endbr32 
  8012a5:	55                   	push   %ebp
  8012a6:	89 e5                	mov    %esp,%ebp
  8012a8:	57                   	push   %edi
  8012a9:	56                   	push   %esi
  8012aa:	53                   	push   %ebx
  8012ab:	83 ec 0c             	sub    $0xc,%esp
  8012ae:	8b 7d 08             	mov    0x8(%ebp),%edi
  8012b1:	8b 75 10             	mov    0x10(%ebp),%esi
	int m, tot;

	for (tot = 0; tot < n; tot += m) {
  8012b4:	bb 00 00 00 00       	mov    $0x0,%ebx
  8012b9:	eb 02                	jmp    8012bd <readn+0x1c>
  8012bb:	01 c3                	add    %eax,%ebx
  8012bd:	39 f3                	cmp    %esi,%ebx
  8012bf:	73 21                	jae    8012e2 <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  8012c1:	83 ec 04             	sub    $0x4,%esp
  8012c4:	89 f0                	mov    %esi,%eax
  8012c6:	29 d8                	sub    %ebx,%eax
  8012c8:	50                   	push   %eax
  8012c9:	89 d8                	mov    %ebx,%eax
  8012cb:	03 45 0c             	add    0xc(%ebp),%eax
  8012ce:	50                   	push   %eax
  8012cf:	57                   	push   %edi
  8012d0:	e8 41 ff ff ff       	call   801216 <read>
		if (m < 0)
  8012d5:	83 c4 10             	add    $0x10,%esp
  8012d8:	85 c0                	test   %eax,%eax
  8012da:	78 04                	js     8012e0 <readn+0x3f>
			return m;
		if (m == 0)
  8012dc:	75 dd                	jne    8012bb <readn+0x1a>
  8012de:	eb 02                	jmp    8012e2 <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  8012e0:	89 c3                	mov    %eax,%ebx
			break;
	}
	return tot;
}
  8012e2:	89 d8                	mov    %ebx,%eax
  8012e4:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8012e7:	5b                   	pop    %ebx
  8012e8:	5e                   	pop    %esi
  8012e9:	5f                   	pop    %edi
  8012ea:	5d                   	pop    %ebp
  8012eb:	c3                   	ret    

008012ec <write>:

ssize_t
write(int fdnum, const void *buf, size_t n)
{
  8012ec:	f3 0f 1e fb          	endbr32 
  8012f0:	55                   	push   %ebp
  8012f1:	89 e5                	mov    %esp,%ebp
  8012f3:	53                   	push   %ebx
  8012f4:	83 ec 1c             	sub    $0x1c,%esp
  8012f7:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  8012fa:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8012fd:	50                   	push   %eax
  8012fe:	53                   	push   %ebx
  8012ff:	e8 8f fc ff ff       	call   800f93 <fd_lookup>
  801304:	83 c4 10             	add    $0x10,%esp
  801307:	85 c0                	test   %eax,%eax
  801309:	78 3a                	js     801345 <write+0x59>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  80130b:	83 ec 08             	sub    $0x8,%esp
  80130e:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801311:	50                   	push   %eax
  801312:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801315:	ff 30                	pushl  (%eax)
  801317:	e8 cb fc ff ff       	call   800fe7 <dev_lookup>
  80131c:	83 c4 10             	add    $0x10,%esp
  80131f:	85 c0                	test   %eax,%eax
  801321:	78 22                	js     801345 <write+0x59>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  801323:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801326:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  80132a:	74 1e                	je     80134a <write+0x5e>
		return -E_INVAL;
	}
	if (debug)
		cprintf("write %d %p %d via dev %s\n",
			fdnum, buf, n, dev->dev_name);
	if (!dev->dev_write)
  80132c:	8b 55 f4             	mov    -0xc(%ebp),%edx
  80132f:	8b 52 0c             	mov    0xc(%edx),%edx
  801332:	85 d2                	test   %edx,%edx
  801334:	74 35                	je     80136b <write+0x7f>
		return -E_NOT_SUPP;
	return (*dev->dev_write)(fd, buf, n);
  801336:	83 ec 04             	sub    $0x4,%esp
  801339:	ff 75 10             	pushl  0x10(%ebp)
  80133c:	ff 75 0c             	pushl  0xc(%ebp)
  80133f:	50                   	push   %eax
  801340:	ff d2                	call   *%edx
  801342:	83 c4 10             	add    $0x10,%esp
}
  801345:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801348:	c9                   	leave  
  801349:	c3                   	ret    
		cprintf("[%08x] write %d -- bad mode\n", thisenv->env_id, fdnum);
  80134a:	a1 08 40 80 00       	mov    0x804008,%eax
  80134f:	8b 40 48             	mov    0x48(%eax),%eax
  801352:	83 ec 04             	sub    $0x4,%esp
  801355:	53                   	push   %ebx
  801356:	50                   	push   %eax
  801357:	68 49 25 80 00       	push   $0x802549
  80135c:	e8 81 ef ff ff       	call   8002e2 <cprintf>
		return -E_INVAL;
  801361:	83 c4 10             	add    $0x10,%esp
  801364:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801369:	eb da                	jmp    801345 <write+0x59>
		return -E_NOT_SUPP;
  80136b:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801370:	eb d3                	jmp    801345 <write+0x59>

00801372 <seek>:

int
seek(int fdnum, off_t offset)
{
  801372:	f3 0f 1e fb          	endbr32 
  801376:	55                   	push   %ebp
  801377:	89 e5                	mov    %esp,%ebp
  801379:	83 ec 20             	sub    $0x20,%esp
	int r;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  80137c:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80137f:	50                   	push   %eax
  801380:	ff 75 08             	pushl  0x8(%ebp)
  801383:	e8 0b fc ff ff       	call   800f93 <fd_lookup>
  801388:	83 c4 10             	add    $0x10,%esp
  80138b:	85 c0                	test   %eax,%eax
  80138d:	78 0e                	js     80139d <seek+0x2b>
		return r;
	fd->fd_offset = offset;
  80138f:	8b 55 0c             	mov    0xc(%ebp),%edx
  801392:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801395:	89 50 04             	mov    %edx,0x4(%eax)
	return 0;
  801398:	b8 00 00 00 00       	mov    $0x0,%eax
}
  80139d:	c9                   	leave  
  80139e:	c3                   	ret    

0080139f <ftruncate>:

int
ftruncate(int fdnum, off_t newsize)
{
  80139f:	f3 0f 1e fb          	endbr32 
  8013a3:	55                   	push   %ebp
  8013a4:	89 e5                	mov    %esp,%ebp
  8013a6:	53                   	push   %ebx
  8013a7:	83 ec 1c             	sub    $0x1c,%esp
  8013aa:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;
	if ((r = fd_lookup(fdnum, &fd)) < 0
  8013ad:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8013b0:	50                   	push   %eax
  8013b1:	53                   	push   %ebx
  8013b2:	e8 dc fb ff ff       	call   800f93 <fd_lookup>
  8013b7:	83 c4 10             	add    $0x10,%esp
  8013ba:	85 c0                	test   %eax,%eax
  8013bc:	78 37                	js     8013f5 <ftruncate+0x56>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  8013be:	83 ec 08             	sub    $0x8,%esp
  8013c1:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8013c4:	50                   	push   %eax
  8013c5:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8013c8:	ff 30                	pushl  (%eax)
  8013ca:	e8 18 fc ff ff       	call   800fe7 <dev_lookup>
  8013cf:	83 c4 10             	add    $0x10,%esp
  8013d2:	85 c0                	test   %eax,%eax
  8013d4:	78 1f                	js     8013f5 <ftruncate+0x56>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  8013d6:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8013d9:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  8013dd:	74 1b                	je     8013fa <ftruncate+0x5b>
		cprintf("[%08x] ftruncate %d -- bad mode\n",
			thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_trunc)
  8013df:	8b 55 f4             	mov    -0xc(%ebp),%edx
  8013e2:	8b 52 18             	mov    0x18(%edx),%edx
  8013e5:	85 d2                	test   %edx,%edx
  8013e7:	74 32                	je     80141b <ftruncate+0x7c>
		return -E_NOT_SUPP;
	return (*dev->dev_trunc)(fd, newsize);
  8013e9:	83 ec 08             	sub    $0x8,%esp
  8013ec:	ff 75 0c             	pushl  0xc(%ebp)
  8013ef:	50                   	push   %eax
  8013f0:	ff d2                	call   *%edx
  8013f2:	83 c4 10             	add    $0x10,%esp
}
  8013f5:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8013f8:	c9                   	leave  
  8013f9:	c3                   	ret    
			thisenv->env_id, fdnum);
  8013fa:	a1 08 40 80 00       	mov    0x804008,%eax
		cprintf("[%08x] ftruncate %d -- bad mode\n",
  8013ff:	8b 40 48             	mov    0x48(%eax),%eax
  801402:	83 ec 04             	sub    $0x4,%esp
  801405:	53                   	push   %ebx
  801406:	50                   	push   %eax
  801407:	68 0c 25 80 00       	push   $0x80250c
  80140c:	e8 d1 ee ff ff       	call   8002e2 <cprintf>
		return -E_INVAL;
  801411:	83 c4 10             	add    $0x10,%esp
  801414:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801419:	eb da                	jmp    8013f5 <ftruncate+0x56>
		return -E_NOT_SUPP;
  80141b:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801420:	eb d3                	jmp    8013f5 <ftruncate+0x56>

00801422 <fstat>:

int
fstat(int fdnum, struct Stat *stat)
{
  801422:	f3 0f 1e fb          	endbr32 
  801426:	55                   	push   %ebp
  801427:	89 e5                	mov    %esp,%ebp
  801429:	53                   	push   %ebx
  80142a:	83 ec 1c             	sub    $0x1c,%esp
  80142d:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801430:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801433:	50                   	push   %eax
  801434:	ff 75 08             	pushl  0x8(%ebp)
  801437:	e8 57 fb ff ff       	call   800f93 <fd_lookup>
  80143c:	83 c4 10             	add    $0x10,%esp
  80143f:	85 c0                	test   %eax,%eax
  801441:	78 4b                	js     80148e <fstat+0x6c>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801443:	83 ec 08             	sub    $0x8,%esp
  801446:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801449:	50                   	push   %eax
  80144a:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80144d:	ff 30                	pushl  (%eax)
  80144f:	e8 93 fb ff ff       	call   800fe7 <dev_lookup>
  801454:	83 c4 10             	add    $0x10,%esp
  801457:	85 c0                	test   %eax,%eax
  801459:	78 33                	js     80148e <fstat+0x6c>
		return r;
	if (!dev->dev_stat)
  80145b:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80145e:	83 78 14 00          	cmpl   $0x0,0x14(%eax)
  801462:	74 2f                	je     801493 <fstat+0x71>
		return -E_NOT_SUPP;
	stat->st_name[0] = 0;
  801464:	c6 03 00             	movb   $0x0,(%ebx)
	stat->st_size = 0;
  801467:	c7 83 80 00 00 00 00 	movl   $0x0,0x80(%ebx)
  80146e:	00 00 00 
	stat->st_isdir = 0;
  801471:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  801478:	00 00 00 
	stat->st_dev = dev;
  80147b:	89 83 88 00 00 00    	mov    %eax,0x88(%ebx)
	return (*dev->dev_stat)(fd, stat);
  801481:	83 ec 08             	sub    $0x8,%esp
  801484:	53                   	push   %ebx
  801485:	ff 75 f0             	pushl  -0x10(%ebp)
  801488:	ff 50 14             	call   *0x14(%eax)
  80148b:	83 c4 10             	add    $0x10,%esp
}
  80148e:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801491:	c9                   	leave  
  801492:	c3                   	ret    
		return -E_NOT_SUPP;
  801493:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801498:	eb f4                	jmp    80148e <fstat+0x6c>

0080149a <stat>:

int
stat(const char *path, struct Stat *stat)
{
  80149a:	f3 0f 1e fb          	endbr32 
  80149e:	55                   	push   %ebp
  80149f:	89 e5                	mov    %esp,%ebp
  8014a1:	56                   	push   %esi
  8014a2:	53                   	push   %ebx
	int fd, r;

	if ((fd = open(path, O_RDONLY)) < 0)
  8014a3:	83 ec 08             	sub    $0x8,%esp
  8014a6:	6a 00                	push   $0x0
  8014a8:	ff 75 08             	pushl  0x8(%ebp)
  8014ab:	e8 fb 01 00 00       	call   8016ab <open>
  8014b0:	89 c3                	mov    %eax,%ebx
  8014b2:	83 c4 10             	add    $0x10,%esp
  8014b5:	85 c0                	test   %eax,%eax
  8014b7:	78 1b                	js     8014d4 <stat+0x3a>
		return fd;
	r = fstat(fd, stat);
  8014b9:	83 ec 08             	sub    $0x8,%esp
  8014bc:	ff 75 0c             	pushl  0xc(%ebp)
  8014bf:	50                   	push   %eax
  8014c0:	e8 5d ff ff ff       	call   801422 <fstat>
  8014c5:	89 c6                	mov    %eax,%esi
	close(fd);
  8014c7:	89 1c 24             	mov    %ebx,(%esp)
  8014ca:	e8 fd fb ff ff       	call   8010cc <close>
	return r;
  8014cf:	83 c4 10             	add    $0x10,%esp
  8014d2:	89 f3                	mov    %esi,%ebx
}
  8014d4:	89 d8                	mov    %ebx,%eax
  8014d6:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8014d9:	5b                   	pop    %ebx
  8014da:	5e                   	pop    %esi
  8014db:	5d                   	pop    %ebp
  8014dc:	c3                   	ret    

008014dd <fsipc>:
// type: request code, passed as the simple integer IPC value.
// dstva: virtual address at which to receive reply page, 0 if none.
// Returns result from the file server.
static int
fsipc(unsigned type, void *dstva)
{
  8014dd:	55                   	push   %ebp
  8014de:	89 e5                	mov    %esp,%ebp
  8014e0:	56                   	push   %esi
  8014e1:	53                   	push   %ebx
  8014e2:	89 c6                	mov    %eax,%esi
  8014e4:	89 d3                	mov    %edx,%ebx
	static envid_t fsenv;
	if (fsenv == 0)
  8014e6:	83 3d 04 40 80 00 00 	cmpl   $0x0,0x804004
  8014ed:	74 27                	je     801516 <fsipc+0x39>
	static_assert(sizeof(fsipcbuf) == PGSIZE);

	if (debug)
		cprintf("[%08x] fsipc %d %08x\n", thisenv->env_id, type, *(uint32_t *)&fsipcbuf);

	ipc_send(fsenv, type, &fsipcbuf, PTE_P | PTE_W | PTE_U);
  8014ef:	6a 07                	push   $0x7
  8014f1:	68 00 50 80 00       	push   $0x805000
  8014f6:	56                   	push   %esi
  8014f7:	ff 35 04 40 80 00    	pushl  0x804004
  8014fd:	e8 f6 08 00 00       	call   801df8 <ipc_send>
	return ipc_recv(NULL, dstva, NULL);
  801502:	83 c4 0c             	add    $0xc,%esp
  801505:	6a 00                	push   $0x0
  801507:	53                   	push   %ebx
  801508:	6a 00                	push   $0x0
  80150a:	e8 68 08 00 00       	call   801d77 <ipc_recv>
}
  80150f:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801512:	5b                   	pop    %ebx
  801513:	5e                   	pop    %esi
  801514:	5d                   	pop    %ebp
  801515:	c3                   	ret    
		fsenv = ipc_find_env(ENV_TYPE_FS);
  801516:	83 ec 0c             	sub    $0xc,%esp
  801519:	6a 01                	push   $0x1
  80151b:	e8 30 09 00 00       	call   801e50 <ipc_find_env>
  801520:	a3 04 40 80 00       	mov    %eax,0x804004
  801525:	83 c4 10             	add    $0x10,%esp
  801528:	eb c5                	jmp    8014ef <fsipc+0x12>

0080152a <devfile_trunc>:
}

// Truncate or extend an open file to 'size' bytes
static int
devfile_trunc(struct Fd *fd, off_t newsize)
{
  80152a:	f3 0f 1e fb          	endbr32 
  80152e:	55                   	push   %ebp
  80152f:	89 e5                	mov    %esp,%ebp
  801531:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.set_size.req_fileid = fd->fd_file.id;
  801534:	8b 45 08             	mov    0x8(%ebp),%eax
  801537:	8b 40 0c             	mov    0xc(%eax),%eax
  80153a:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.set_size.req_size = newsize;
  80153f:	8b 45 0c             	mov    0xc(%ebp),%eax
  801542:	a3 04 50 80 00       	mov    %eax,0x805004
	return fsipc(FSREQ_SET_SIZE, NULL);
  801547:	ba 00 00 00 00       	mov    $0x0,%edx
  80154c:	b8 02 00 00 00       	mov    $0x2,%eax
  801551:	e8 87 ff ff ff       	call   8014dd <fsipc>
}
  801556:	c9                   	leave  
  801557:	c3                   	ret    

00801558 <devfile_flush>:
{
  801558:	f3 0f 1e fb          	endbr32 
  80155c:	55                   	push   %ebp
  80155d:	89 e5                	mov    %esp,%ebp
  80155f:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.flush.req_fileid = fd->fd_file.id;
  801562:	8b 45 08             	mov    0x8(%ebp),%eax
  801565:	8b 40 0c             	mov    0xc(%eax),%eax
  801568:	a3 00 50 80 00       	mov    %eax,0x805000
	return fsipc(FSREQ_FLUSH, NULL);
  80156d:	ba 00 00 00 00       	mov    $0x0,%edx
  801572:	b8 06 00 00 00       	mov    $0x6,%eax
  801577:	e8 61 ff ff ff       	call   8014dd <fsipc>
}
  80157c:	c9                   	leave  
  80157d:	c3                   	ret    

0080157e <devfile_stat>:
{
  80157e:	f3 0f 1e fb          	endbr32 
  801582:	55                   	push   %ebp
  801583:	89 e5                	mov    %esp,%ebp
  801585:	53                   	push   %ebx
  801586:	83 ec 04             	sub    $0x4,%esp
  801589:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	fsipcbuf.stat.req_fileid = fd->fd_file.id;
  80158c:	8b 45 08             	mov    0x8(%ebp),%eax
  80158f:	8b 40 0c             	mov    0xc(%eax),%eax
  801592:	a3 00 50 80 00       	mov    %eax,0x805000
	if ((r = fsipc(FSREQ_STAT, NULL)) < 0)
  801597:	ba 00 00 00 00       	mov    $0x0,%edx
  80159c:	b8 05 00 00 00       	mov    $0x5,%eax
  8015a1:	e8 37 ff ff ff       	call   8014dd <fsipc>
  8015a6:	85 c0                	test   %eax,%eax
  8015a8:	78 2c                	js     8015d6 <devfile_stat+0x58>
	strcpy(st->st_name, fsipcbuf.statRet.ret_name);
  8015aa:	83 ec 08             	sub    $0x8,%esp
  8015ad:	68 00 50 80 00       	push   $0x805000
  8015b2:	53                   	push   %ebx
  8015b3:	e8 03 f3 ff ff       	call   8008bb <strcpy>
	st->st_size = fsipcbuf.statRet.ret_size;
  8015b8:	a1 80 50 80 00       	mov    0x805080,%eax
  8015bd:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	st->st_isdir = fsipcbuf.statRet.ret_isdir;
  8015c3:	a1 84 50 80 00       	mov    0x805084,%eax
  8015c8:	89 83 84 00 00 00    	mov    %eax,0x84(%ebx)
	return 0;
  8015ce:	83 c4 10             	add    $0x10,%esp
  8015d1:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8015d6:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8015d9:	c9                   	leave  
  8015da:	c3                   	ret    

008015db <devfile_write>:
{
  8015db:	f3 0f 1e fb          	endbr32 
  8015df:	55                   	push   %ebp
  8015e0:	89 e5                	mov    %esp,%ebp
  8015e2:	83 ec 0c             	sub    $0xc,%esp
  8015e5:	8b 45 10             	mov    0x10(%ebp),%eax
  8015e8:	3d f8 0f 00 00       	cmp    $0xff8,%eax
  8015ed:	ba f8 0f 00 00       	mov    $0xff8,%edx
  8015f2:	0f 47 c2             	cmova  %edx,%eax
	fsipcbuf.write.req_fileid = fd->fd_file.id;
  8015f5:	8b 55 08             	mov    0x8(%ebp),%edx
  8015f8:	8b 52 0c             	mov    0xc(%edx),%edx
  8015fb:	89 15 00 50 80 00    	mov    %edx,0x805000
	fsipcbuf.write.req_n = n;
  801601:	a3 04 50 80 00       	mov    %eax,0x805004
	memmove(fsipcbuf.write.req_buf, buf, n);
  801606:	50                   	push   %eax
  801607:	ff 75 0c             	pushl  0xc(%ebp)
  80160a:	68 08 50 80 00       	push   $0x805008
  80160f:	e8 5d f4 ff ff       	call   800a71 <memmove>
	return fsipc(FSREQ_WRITE, NULL);}
  801614:	ba 00 00 00 00       	mov    $0x0,%edx
  801619:	b8 04 00 00 00       	mov    $0x4,%eax
  80161e:	e8 ba fe ff ff       	call   8014dd <fsipc>
  801623:	c9                   	leave  
  801624:	c3                   	ret    

00801625 <devfile_read>:
{
  801625:	f3 0f 1e fb          	endbr32 
  801629:	55                   	push   %ebp
  80162a:	89 e5                	mov    %esp,%ebp
  80162c:	56                   	push   %esi
  80162d:	53                   	push   %ebx
  80162e:	8b 75 10             	mov    0x10(%ebp),%esi
	fsipcbuf.read.req_fileid = fd->fd_file.id;
  801631:	8b 45 08             	mov    0x8(%ebp),%eax
  801634:	8b 40 0c             	mov    0xc(%eax),%eax
  801637:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.read.req_n = n;
  80163c:	89 35 04 50 80 00    	mov    %esi,0x805004
	if ((r = fsipc(FSREQ_READ, NULL)) < 0)
  801642:	ba 00 00 00 00       	mov    $0x0,%edx
  801647:	b8 03 00 00 00       	mov    $0x3,%eax
  80164c:	e8 8c fe ff ff       	call   8014dd <fsipc>
  801651:	89 c3                	mov    %eax,%ebx
  801653:	85 c0                	test   %eax,%eax
  801655:	78 1f                	js     801676 <devfile_read+0x51>
	assert(r <= n);
  801657:	39 f0                	cmp    %esi,%eax
  801659:	77 24                	ja     80167f <devfile_read+0x5a>
	assert(r <= PGSIZE);
  80165b:	3d 00 10 00 00       	cmp    $0x1000,%eax
  801660:	7f 33                	jg     801695 <devfile_read+0x70>
	memmove(buf, fsipcbuf.readRet.ret_buf, r);
  801662:	83 ec 04             	sub    $0x4,%esp
  801665:	50                   	push   %eax
  801666:	68 00 50 80 00       	push   $0x805000
  80166b:	ff 75 0c             	pushl  0xc(%ebp)
  80166e:	e8 fe f3 ff ff       	call   800a71 <memmove>
	return r;
  801673:	83 c4 10             	add    $0x10,%esp
}
  801676:	89 d8                	mov    %ebx,%eax
  801678:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80167b:	5b                   	pop    %ebx
  80167c:	5e                   	pop    %esi
  80167d:	5d                   	pop    %ebp
  80167e:	c3                   	ret    
	assert(r <= n);
  80167f:	68 78 25 80 00       	push   $0x802578
  801684:	68 7f 25 80 00       	push   $0x80257f
  801689:	6a 7c                	push   $0x7c
  80168b:	68 94 25 80 00       	push   $0x802594
  801690:	e8 66 eb ff ff       	call   8001fb <_panic>
	assert(r <= PGSIZE);
  801695:	68 9f 25 80 00       	push   $0x80259f
  80169a:	68 7f 25 80 00       	push   $0x80257f
  80169f:	6a 7d                	push   $0x7d
  8016a1:	68 94 25 80 00       	push   $0x802594
  8016a6:	e8 50 eb ff ff       	call   8001fb <_panic>

008016ab <open>:
{
  8016ab:	f3 0f 1e fb          	endbr32 
  8016af:	55                   	push   %ebp
  8016b0:	89 e5                	mov    %esp,%ebp
  8016b2:	56                   	push   %esi
  8016b3:	53                   	push   %ebx
  8016b4:	83 ec 1c             	sub    $0x1c,%esp
  8016b7:	8b 75 08             	mov    0x8(%ebp),%esi
	if (strlen(path) >= MAXPATHLEN)
  8016ba:	56                   	push   %esi
  8016bb:	e8 b8 f1 ff ff       	call   800878 <strlen>
  8016c0:	83 c4 10             	add    $0x10,%esp
  8016c3:	3d ff 03 00 00       	cmp    $0x3ff,%eax
  8016c8:	7f 6c                	jg     801736 <open+0x8b>
	if ((r = fd_alloc(&fd)) < 0)
  8016ca:	83 ec 0c             	sub    $0xc,%esp
  8016cd:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8016d0:	50                   	push   %eax
  8016d1:	e8 67 f8 ff ff       	call   800f3d <fd_alloc>
  8016d6:	89 c3                	mov    %eax,%ebx
  8016d8:	83 c4 10             	add    $0x10,%esp
  8016db:	85 c0                	test   %eax,%eax
  8016dd:	78 3c                	js     80171b <open+0x70>
	strcpy(fsipcbuf.open.req_path, path);
  8016df:	83 ec 08             	sub    $0x8,%esp
  8016e2:	56                   	push   %esi
  8016e3:	68 00 50 80 00       	push   $0x805000
  8016e8:	e8 ce f1 ff ff       	call   8008bb <strcpy>
	fsipcbuf.open.req_omode = mode;
  8016ed:	8b 45 0c             	mov    0xc(%ebp),%eax
  8016f0:	a3 00 54 80 00       	mov    %eax,0x805400
	if ((r = fsipc(FSREQ_OPEN, fd)) < 0) {
  8016f5:	8b 55 f4             	mov    -0xc(%ebp),%edx
  8016f8:	b8 01 00 00 00       	mov    $0x1,%eax
  8016fd:	e8 db fd ff ff       	call   8014dd <fsipc>
  801702:	89 c3                	mov    %eax,%ebx
  801704:	83 c4 10             	add    $0x10,%esp
  801707:	85 c0                	test   %eax,%eax
  801709:	78 19                	js     801724 <open+0x79>
	return fd2num(fd);
  80170b:	83 ec 0c             	sub    $0xc,%esp
  80170e:	ff 75 f4             	pushl  -0xc(%ebp)
  801711:	e8 f8 f7 ff ff       	call   800f0e <fd2num>
  801716:	89 c3                	mov    %eax,%ebx
  801718:	83 c4 10             	add    $0x10,%esp
}
  80171b:	89 d8                	mov    %ebx,%eax
  80171d:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801720:	5b                   	pop    %ebx
  801721:	5e                   	pop    %esi
  801722:	5d                   	pop    %ebp
  801723:	c3                   	ret    
		fd_close(fd, 0);
  801724:	83 ec 08             	sub    $0x8,%esp
  801727:	6a 00                	push   $0x0
  801729:	ff 75 f4             	pushl  -0xc(%ebp)
  80172c:	e8 10 f9 ff ff       	call   801041 <fd_close>
		return r;
  801731:	83 c4 10             	add    $0x10,%esp
  801734:	eb e5                	jmp    80171b <open+0x70>
		return -E_BAD_PATH;
  801736:	bb f4 ff ff ff       	mov    $0xfffffff4,%ebx
  80173b:	eb de                	jmp    80171b <open+0x70>

0080173d <sync>:


// Synchronize disk with buffer cache
int
sync(void)
{
  80173d:	f3 0f 1e fb          	endbr32 
  801741:	55                   	push   %ebp
  801742:	89 e5                	mov    %esp,%ebp
  801744:	83 ec 08             	sub    $0x8,%esp
	// Ask the file server to update the disk
	// by writing any dirty blocks in the buffer cache.

	return fsipc(FSREQ_SYNC, NULL);
  801747:	ba 00 00 00 00       	mov    $0x0,%edx
  80174c:	b8 08 00 00 00       	mov    $0x8,%eax
  801751:	e8 87 fd ff ff       	call   8014dd <fsipc>
}
  801756:	c9                   	leave  
  801757:	c3                   	ret    

00801758 <writebuf>:


static void
writebuf(struct printbuf *b)
{
	if (b->error > 0) {
  801758:	83 78 0c 00          	cmpl   $0x0,0xc(%eax)
  80175c:	7f 01                	jg     80175f <writebuf+0x7>
  80175e:	c3                   	ret    
{
  80175f:	55                   	push   %ebp
  801760:	89 e5                	mov    %esp,%ebp
  801762:	53                   	push   %ebx
  801763:	83 ec 08             	sub    $0x8,%esp
  801766:	89 c3                	mov    %eax,%ebx
		ssize_t result = write(b->fd, b->buf, b->idx);
  801768:	ff 70 04             	pushl  0x4(%eax)
  80176b:	8d 40 10             	lea    0x10(%eax),%eax
  80176e:	50                   	push   %eax
  80176f:	ff 33                	pushl  (%ebx)
  801771:	e8 76 fb ff ff       	call   8012ec <write>
		if (result > 0)
  801776:	83 c4 10             	add    $0x10,%esp
  801779:	85 c0                	test   %eax,%eax
  80177b:	7e 03                	jle    801780 <writebuf+0x28>
			b->result += result;
  80177d:	01 43 08             	add    %eax,0x8(%ebx)
		if (result != b->idx) // error, or wrote less than supplied
  801780:	39 43 04             	cmp    %eax,0x4(%ebx)
  801783:	74 0d                	je     801792 <writebuf+0x3a>
			b->error = (result < 0 ? result : 0);
  801785:	85 c0                	test   %eax,%eax
  801787:	ba 00 00 00 00       	mov    $0x0,%edx
  80178c:	0f 4f c2             	cmovg  %edx,%eax
  80178f:	89 43 0c             	mov    %eax,0xc(%ebx)
	}
}
  801792:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801795:	c9                   	leave  
  801796:	c3                   	ret    

00801797 <putch>:

static void
putch(int ch, void *thunk)
{
  801797:	f3 0f 1e fb          	endbr32 
  80179b:	55                   	push   %ebp
  80179c:	89 e5                	mov    %esp,%ebp
  80179e:	53                   	push   %ebx
  80179f:	83 ec 04             	sub    $0x4,%esp
  8017a2:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	struct printbuf *b = (struct printbuf *) thunk;
	b->buf[b->idx++] = ch;
  8017a5:	8b 53 04             	mov    0x4(%ebx),%edx
  8017a8:	8d 42 01             	lea    0x1(%edx),%eax
  8017ab:	89 43 04             	mov    %eax,0x4(%ebx)
  8017ae:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8017b1:	88 4c 13 10          	mov    %cl,0x10(%ebx,%edx,1)
	if (b->idx == 256) {
  8017b5:	3d 00 01 00 00       	cmp    $0x100,%eax
  8017ba:	74 06                	je     8017c2 <putch+0x2b>
		writebuf(b);
		b->idx = 0;
	}
}
  8017bc:	83 c4 04             	add    $0x4,%esp
  8017bf:	5b                   	pop    %ebx
  8017c0:	5d                   	pop    %ebp
  8017c1:	c3                   	ret    
		writebuf(b);
  8017c2:	89 d8                	mov    %ebx,%eax
  8017c4:	e8 8f ff ff ff       	call   801758 <writebuf>
		b->idx = 0;
  8017c9:	c7 43 04 00 00 00 00 	movl   $0x0,0x4(%ebx)
}
  8017d0:	eb ea                	jmp    8017bc <putch+0x25>

008017d2 <vfprintf>:

int
vfprintf(int fd, const char *fmt, va_list ap)
{
  8017d2:	f3 0f 1e fb          	endbr32 
  8017d6:	55                   	push   %ebp
  8017d7:	89 e5                	mov    %esp,%ebp
  8017d9:	81 ec 18 01 00 00    	sub    $0x118,%esp
	struct printbuf b;

	b.fd = fd;
  8017df:	8b 45 08             	mov    0x8(%ebp),%eax
  8017e2:	89 85 e8 fe ff ff    	mov    %eax,-0x118(%ebp)
	b.idx = 0;
  8017e8:	c7 85 ec fe ff ff 00 	movl   $0x0,-0x114(%ebp)
  8017ef:	00 00 00 
	b.result = 0;
  8017f2:	c7 85 f0 fe ff ff 00 	movl   $0x0,-0x110(%ebp)
  8017f9:	00 00 00 
	b.error = 1;
  8017fc:	c7 85 f4 fe ff ff 01 	movl   $0x1,-0x10c(%ebp)
  801803:	00 00 00 
	vprintfmt(putch, &b, fmt, ap);
  801806:	ff 75 10             	pushl  0x10(%ebp)
  801809:	ff 75 0c             	pushl  0xc(%ebp)
  80180c:	8d 85 e8 fe ff ff    	lea    -0x118(%ebp),%eax
  801812:	50                   	push   %eax
  801813:	68 97 17 80 00       	push   $0x801797
  801818:	e8 c8 eb ff ff       	call   8003e5 <vprintfmt>
	if (b.idx > 0)
  80181d:	83 c4 10             	add    $0x10,%esp
  801820:	83 bd ec fe ff ff 00 	cmpl   $0x0,-0x114(%ebp)
  801827:	7f 11                	jg     80183a <vfprintf+0x68>
		writebuf(&b);

	return (b.result ? b.result : b.error);
  801829:	8b 85 f0 fe ff ff    	mov    -0x110(%ebp),%eax
  80182f:	85 c0                	test   %eax,%eax
  801831:	0f 44 85 f4 fe ff ff 	cmove  -0x10c(%ebp),%eax
}
  801838:	c9                   	leave  
  801839:	c3                   	ret    
		writebuf(&b);
  80183a:	8d 85 e8 fe ff ff    	lea    -0x118(%ebp),%eax
  801840:	e8 13 ff ff ff       	call   801758 <writebuf>
  801845:	eb e2                	jmp    801829 <vfprintf+0x57>

00801847 <fprintf>:

int
fprintf(int fd, const char *fmt, ...)
{
  801847:	f3 0f 1e fb          	endbr32 
  80184b:	55                   	push   %ebp
  80184c:	89 e5                	mov    %esp,%ebp
  80184e:	83 ec 0c             	sub    $0xc,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
  801851:	8d 45 10             	lea    0x10(%ebp),%eax
	cnt = vfprintf(fd, fmt, ap);
  801854:	50                   	push   %eax
  801855:	ff 75 0c             	pushl  0xc(%ebp)
  801858:	ff 75 08             	pushl  0x8(%ebp)
  80185b:	e8 72 ff ff ff       	call   8017d2 <vfprintf>
	va_end(ap);

	return cnt;
}
  801860:	c9                   	leave  
  801861:	c3                   	ret    

00801862 <printf>:

int
printf(const char *fmt, ...)
{
  801862:	f3 0f 1e fb          	endbr32 
  801866:	55                   	push   %ebp
  801867:	89 e5                	mov    %esp,%ebp
  801869:	83 ec 0c             	sub    $0xc,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
  80186c:	8d 45 0c             	lea    0xc(%ebp),%eax
	cnt = vfprintf(1, fmt, ap);
  80186f:	50                   	push   %eax
  801870:	ff 75 08             	pushl  0x8(%ebp)
  801873:	6a 01                	push   $0x1
  801875:	e8 58 ff ff ff       	call   8017d2 <vfprintf>
	va_end(ap);

	return cnt;
}
  80187a:	c9                   	leave  
  80187b:	c3                   	ret    

0080187c <devpipe_stat>:
	return i;
}

static int
devpipe_stat(struct Fd *fd, struct Stat *stat)
{
  80187c:	f3 0f 1e fb          	endbr32 
  801880:	55                   	push   %ebp
  801881:	89 e5                	mov    %esp,%ebp
  801883:	56                   	push   %esi
  801884:	53                   	push   %ebx
  801885:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	struct Pipe *p = (struct Pipe*) fd2data(fd);
  801888:	83 ec 0c             	sub    $0xc,%esp
  80188b:	ff 75 08             	pushl  0x8(%ebp)
  80188e:	e8 8f f6 ff ff       	call   800f22 <fd2data>
  801893:	89 c6                	mov    %eax,%esi
	strcpy(stat->st_name, "<pipe>");
  801895:	83 c4 08             	add    $0x8,%esp
  801898:	68 ab 25 80 00       	push   $0x8025ab
  80189d:	53                   	push   %ebx
  80189e:	e8 18 f0 ff ff       	call   8008bb <strcpy>
	stat->st_size = p->p_wpos - p->p_rpos;
  8018a3:	8b 46 04             	mov    0x4(%esi),%eax
  8018a6:	2b 06                	sub    (%esi),%eax
  8018a8:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	stat->st_isdir = 0;
  8018ae:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  8018b5:	00 00 00 
	stat->st_dev = &devpipe;
  8018b8:	c7 83 88 00 00 00 24 	movl   $0x803024,0x88(%ebx)
  8018bf:	30 80 00 
	return 0;
}
  8018c2:	b8 00 00 00 00       	mov    $0x0,%eax
  8018c7:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8018ca:	5b                   	pop    %ebx
  8018cb:	5e                   	pop    %esi
  8018cc:	5d                   	pop    %ebp
  8018cd:	c3                   	ret    

008018ce <devpipe_close>:

static int
devpipe_close(struct Fd *fd)
{
  8018ce:	f3 0f 1e fb          	endbr32 
  8018d2:	55                   	push   %ebp
  8018d3:	89 e5                	mov    %esp,%ebp
  8018d5:	53                   	push   %ebx
  8018d6:	83 ec 0c             	sub    $0xc,%esp
  8018d9:	8b 5d 08             	mov    0x8(%ebp),%ebx
	(void) sys_page_unmap(0, fd);
  8018dc:	53                   	push   %ebx
  8018dd:	6a 00                	push   $0x0
  8018df:	e8 a6 f4 ff ff       	call   800d8a <sys_page_unmap>
	return sys_page_unmap(0, fd2data(fd));
  8018e4:	89 1c 24             	mov    %ebx,(%esp)
  8018e7:	e8 36 f6 ff ff       	call   800f22 <fd2data>
  8018ec:	83 c4 08             	add    $0x8,%esp
  8018ef:	50                   	push   %eax
  8018f0:	6a 00                	push   $0x0
  8018f2:	e8 93 f4 ff ff       	call   800d8a <sys_page_unmap>
}
  8018f7:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8018fa:	c9                   	leave  
  8018fb:	c3                   	ret    

008018fc <_pipeisclosed>:
{
  8018fc:	55                   	push   %ebp
  8018fd:	89 e5                	mov    %esp,%ebp
  8018ff:	57                   	push   %edi
  801900:	56                   	push   %esi
  801901:	53                   	push   %ebx
  801902:	83 ec 1c             	sub    $0x1c,%esp
  801905:	89 c7                	mov    %eax,%edi
  801907:	89 d6                	mov    %edx,%esi
		n = thisenv->env_runs;
  801909:	a1 08 40 80 00       	mov    0x804008,%eax
  80190e:	8b 58 58             	mov    0x58(%eax),%ebx
		ret = pageref(fd) == pageref(p);
  801911:	83 ec 0c             	sub    $0xc,%esp
  801914:	57                   	push   %edi
  801915:	e8 73 05 00 00       	call   801e8d <pageref>
  80191a:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  80191d:	89 34 24             	mov    %esi,(%esp)
  801920:	e8 68 05 00 00       	call   801e8d <pageref>
		nn = thisenv->env_runs;
  801925:	8b 15 08 40 80 00    	mov    0x804008,%edx
  80192b:	8b 4a 58             	mov    0x58(%edx),%ecx
		if (n == nn)
  80192e:	83 c4 10             	add    $0x10,%esp
  801931:	39 cb                	cmp    %ecx,%ebx
  801933:	74 1b                	je     801950 <_pipeisclosed+0x54>
		if (n != nn && ret == 1)
  801935:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801938:	75 cf                	jne    801909 <_pipeisclosed+0xd>
			cprintf("pipe race avoided\n", n, thisenv->env_runs, ret);
  80193a:	8b 42 58             	mov    0x58(%edx),%eax
  80193d:	6a 01                	push   $0x1
  80193f:	50                   	push   %eax
  801940:	53                   	push   %ebx
  801941:	68 b2 25 80 00       	push   $0x8025b2
  801946:	e8 97 e9 ff ff       	call   8002e2 <cprintf>
  80194b:	83 c4 10             	add    $0x10,%esp
  80194e:	eb b9                	jmp    801909 <_pipeisclosed+0xd>
		ret = pageref(fd) == pageref(p);
  801950:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801953:	0f 94 c0             	sete   %al
  801956:	0f b6 c0             	movzbl %al,%eax
}
  801959:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80195c:	5b                   	pop    %ebx
  80195d:	5e                   	pop    %esi
  80195e:	5f                   	pop    %edi
  80195f:	5d                   	pop    %ebp
  801960:	c3                   	ret    

00801961 <devpipe_write>:
{
  801961:	f3 0f 1e fb          	endbr32 
  801965:	55                   	push   %ebp
  801966:	89 e5                	mov    %esp,%ebp
  801968:	57                   	push   %edi
  801969:	56                   	push   %esi
  80196a:	53                   	push   %ebx
  80196b:	83 ec 28             	sub    $0x28,%esp
  80196e:	8b 75 08             	mov    0x8(%ebp),%esi
	p = (struct Pipe*) fd2data(fd);
  801971:	56                   	push   %esi
  801972:	e8 ab f5 ff ff       	call   800f22 <fd2data>
  801977:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801979:	83 c4 10             	add    $0x10,%esp
  80197c:	bf 00 00 00 00       	mov    $0x0,%edi
  801981:	3b 7d 10             	cmp    0x10(%ebp),%edi
  801984:	74 4f                	je     8019d5 <devpipe_write+0x74>
		while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
  801986:	8b 43 04             	mov    0x4(%ebx),%eax
  801989:	8b 0b                	mov    (%ebx),%ecx
  80198b:	8d 51 20             	lea    0x20(%ecx),%edx
  80198e:	39 d0                	cmp    %edx,%eax
  801990:	72 14                	jb     8019a6 <devpipe_write+0x45>
			if (_pipeisclosed(fd, p))
  801992:	89 da                	mov    %ebx,%edx
  801994:	89 f0                	mov    %esi,%eax
  801996:	e8 61 ff ff ff       	call   8018fc <_pipeisclosed>
  80199b:	85 c0                	test   %eax,%eax
  80199d:	75 3b                	jne    8019da <devpipe_write+0x79>
			sys_yield();
  80199f:	e8 36 f3 ff ff       	call   800cda <sys_yield>
  8019a4:	eb e0                	jmp    801986 <devpipe_write+0x25>
		p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
  8019a6:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  8019a9:	0f b6 0c 39          	movzbl (%ecx,%edi,1),%ecx
  8019ad:	88 4d e7             	mov    %cl,-0x19(%ebp)
  8019b0:	89 c2                	mov    %eax,%edx
  8019b2:	c1 fa 1f             	sar    $0x1f,%edx
  8019b5:	89 d1                	mov    %edx,%ecx
  8019b7:	c1 e9 1b             	shr    $0x1b,%ecx
  8019ba:	8d 14 08             	lea    (%eax,%ecx,1),%edx
  8019bd:	83 e2 1f             	and    $0x1f,%edx
  8019c0:	29 ca                	sub    %ecx,%edx
  8019c2:	0f b6 4d e7          	movzbl -0x19(%ebp),%ecx
  8019c6:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
		p->p_wpos++;
  8019ca:	83 c0 01             	add    $0x1,%eax
  8019cd:	89 43 04             	mov    %eax,0x4(%ebx)
	for (i = 0; i < n; i++) {
  8019d0:	83 c7 01             	add    $0x1,%edi
  8019d3:	eb ac                	jmp    801981 <devpipe_write+0x20>
	return i;
  8019d5:	8b 45 10             	mov    0x10(%ebp),%eax
  8019d8:	eb 05                	jmp    8019df <devpipe_write+0x7e>
				return 0;
  8019da:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8019df:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8019e2:	5b                   	pop    %ebx
  8019e3:	5e                   	pop    %esi
  8019e4:	5f                   	pop    %edi
  8019e5:	5d                   	pop    %ebp
  8019e6:	c3                   	ret    

008019e7 <devpipe_read>:
{
  8019e7:	f3 0f 1e fb          	endbr32 
  8019eb:	55                   	push   %ebp
  8019ec:	89 e5                	mov    %esp,%ebp
  8019ee:	57                   	push   %edi
  8019ef:	56                   	push   %esi
  8019f0:	53                   	push   %ebx
  8019f1:	83 ec 18             	sub    $0x18,%esp
  8019f4:	8b 7d 08             	mov    0x8(%ebp),%edi
	p = (struct Pipe*)fd2data(fd);
  8019f7:	57                   	push   %edi
  8019f8:	e8 25 f5 ff ff       	call   800f22 <fd2data>
  8019fd:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  8019ff:	83 c4 10             	add    $0x10,%esp
  801a02:	be 00 00 00 00       	mov    $0x0,%esi
  801a07:	3b 75 10             	cmp    0x10(%ebp),%esi
  801a0a:	75 14                	jne    801a20 <devpipe_read+0x39>
	return i;
  801a0c:	8b 45 10             	mov    0x10(%ebp),%eax
  801a0f:	eb 02                	jmp    801a13 <devpipe_read+0x2c>
				return i;
  801a11:	89 f0                	mov    %esi,%eax
}
  801a13:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801a16:	5b                   	pop    %ebx
  801a17:	5e                   	pop    %esi
  801a18:	5f                   	pop    %edi
  801a19:	5d                   	pop    %ebp
  801a1a:	c3                   	ret    
			sys_yield();
  801a1b:	e8 ba f2 ff ff       	call   800cda <sys_yield>
		while (p->p_rpos == p->p_wpos) {
  801a20:	8b 03                	mov    (%ebx),%eax
  801a22:	3b 43 04             	cmp    0x4(%ebx),%eax
  801a25:	75 18                	jne    801a3f <devpipe_read+0x58>
			if (i > 0)
  801a27:	85 f6                	test   %esi,%esi
  801a29:	75 e6                	jne    801a11 <devpipe_read+0x2a>
			if (_pipeisclosed(fd, p))
  801a2b:	89 da                	mov    %ebx,%edx
  801a2d:	89 f8                	mov    %edi,%eax
  801a2f:	e8 c8 fe ff ff       	call   8018fc <_pipeisclosed>
  801a34:	85 c0                	test   %eax,%eax
  801a36:	74 e3                	je     801a1b <devpipe_read+0x34>
				return 0;
  801a38:	b8 00 00 00 00       	mov    $0x0,%eax
  801a3d:	eb d4                	jmp    801a13 <devpipe_read+0x2c>
		buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
  801a3f:	99                   	cltd   
  801a40:	c1 ea 1b             	shr    $0x1b,%edx
  801a43:	01 d0                	add    %edx,%eax
  801a45:	83 e0 1f             	and    $0x1f,%eax
  801a48:	29 d0                	sub    %edx,%eax
  801a4a:	0f b6 44 03 08       	movzbl 0x8(%ebx,%eax,1),%eax
  801a4f:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801a52:	88 04 31             	mov    %al,(%ecx,%esi,1)
		p->p_rpos++;
  801a55:	83 03 01             	addl   $0x1,(%ebx)
	for (i = 0; i < n; i++) {
  801a58:	83 c6 01             	add    $0x1,%esi
  801a5b:	eb aa                	jmp    801a07 <devpipe_read+0x20>

00801a5d <pipe>:
{
  801a5d:	f3 0f 1e fb          	endbr32 
  801a61:	55                   	push   %ebp
  801a62:	89 e5                	mov    %esp,%ebp
  801a64:	56                   	push   %esi
  801a65:	53                   	push   %ebx
  801a66:	83 ec 1c             	sub    $0x1c,%esp
	if ((r = fd_alloc(&fd0)) < 0
  801a69:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801a6c:	50                   	push   %eax
  801a6d:	e8 cb f4 ff ff       	call   800f3d <fd_alloc>
  801a72:	89 c3                	mov    %eax,%ebx
  801a74:	83 c4 10             	add    $0x10,%esp
  801a77:	85 c0                	test   %eax,%eax
  801a79:	0f 88 23 01 00 00    	js     801ba2 <pipe+0x145>
	    || (r = sys_page_alloc(0, fd0, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801a7f:	83 ec 04             	sub    $0x4,%esp
  801a82:	68 07 04 00 00       	push   $0x407
  801a87:	ff 75 f4             	pushl  -0xc(%ebp)
  801a8a:	6a 00                	push   $0x0
  801a8c:	e8 6c f2 ff ff       	call   800cfd <sys_page_alloc>
  801a91:	89 c3                	mov    %eax,%ebx
  801a93:	83 c4 10             	add    $0x10,%esp
  801a96:	85 c0                	test   %eax,%eax
  801a98:	0f 88 04 01 00 00    	js     801ba2 <pipe+0x145>
	if ((r = fd_alloc(&fd1)) < 0
  801a9e:	83 ec 0c             	sub    $0xc,%esp
  801aa1:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801aa4:	50                   	push   %eax
  801aa5:	e8 93 f4 ff ff       	call   800f3d <fd_alloc>
  801aaa:	89 c3                	mov    %eax,%ebx
  801aac:	83 c4 10             	add    $0x10,%esp
  801aaf:	85 c0                	test   %eax,%eax
  801ab1:	0f 88 db 00 00 00    	js     801b92 <pipe+0x135>
	    || (r = sys_page_alloc(0, fd1, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801ab7:	83 ec 04             	sub    $0x4,%esp
  801aba:	68 07 04 00 00       	push   $0x407
  801abf:	ff 75 f0             	pushl  -0x10(%ebp)
  801ac2:	6a 00                	push   $0x0
  801ac4:	e8 34 f2 ff ff       	call   800cfd <sys_page_alloc>
  801ac9:	89 c3                	mov    %eax,%ebx
  801acb:	83 c4 10             	add    $0x10,%esp
  801ace:	85 c0                	test   %eax,%eax
  801ad0:	0f 88 bc 00 00 00    	js     801b92 <pipe+0x135>
	va = fd2data(fd0);
  801ad6:	83 ec 0c             	sub    $0xc,%esp
  801ad9:	ff 75 f4             	pushl  -0xc(%ebp)
  801adc:	e8 41 f4 ff ff       	call   800f22 <fd2data>
  801ae1:	89 c6                	mov    %eax,%esi
	if ((r = sys_page_alloc(0, va, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801ae3:	83 c4 0c             	add    $0xc,%esp
  801ae6:	68 07 04 00 00       	push   $0x407
  801aeb:	50                   	push   %eax
  801aec:	6a 00                	push   $0x0
  801aee:	e8 0a f2 ff ff       	call   800cfd <sys_page_alloc>
  801af3:	89 c3                	mov    %eax,%ebx
  801af5:	83 c4 10             	add    $0x10,%esp
  801af8:	85 c0                	test   %eax,%eax
  801afa:	0f 88 82 00 00 00    	js     801b82 <pipe+0x125>
	if ((r = sys_page_map(0, va, 0, fd2data(fd1), PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801b00:	83 ec 0c             	sub    $0xc,%esp
  801b03:	ff 75 f0             	pushl  -0x10(%ebp)
  801b06:	e8 17 f4 ff ff       	call   800f22 <fd2data>
  801b0b:	c7 04 24 07 04 00 00 	movl   $0x407,(%esp)
  801b12:	50                   	push   %eax
  801b13:	6a 00                	push   $0x0
  801b15:	56                   	push   %esi
  801b16:	6a 00                	push   $0x0
  801b18:	e8 27 f2 ff ff       	call   800d44 <sys_page_map>
  801b1d:	89 c3                	mov    %eax,%ebx
  801b1f:	83 c4 20             	add    $0x20,%esp
  801b22:	85 c0                	test   %eax,%eax
  801b24:	78 4e                	js     801b74 <pipe+0x117>
	fd0->fd_dev_id = devpipe.dev_id;
  801b26:	a1 24 30 80 00       	mov    0x803024,%eax
  801b2b:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801b2e:	89 02                	mov    %eax,(%edx)
	fd0->fd_omode = O_RDONLY;
  801b30:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801b33:	c7 42 08 00 00 00 00 	movl   $0x0,0x8(%edx)
	fd1->fd_dev_id = devpipe.dev_id;
  801b3a:	8b 55 f0             	mov    -0x10(%ebp),%edx
  801b3d:	89 02                	mov    %eax,(%edx)
	fd1->fd_omode = O_WRONLY;
  801b3f:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801b42:	c7 40 08 01 00 00 00 	movl   $0x1,0x8(%eax)
	pfd[0] = fd2num(fd0);
  801b49:	83 ec 0c             	sub    $0xc,%esp
  801b4c:	ff 75 f4             	pushl  -0xc(%ebp)
  801b4f:	e8 ba f3 ff ff       	call   800f0e <fd2num>
  801b54:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801b57:	89 01                	mov    %eax,(%ecx)
	pfd[1] = fd2num(fd1);
  801b59:	83 c4 04             	add    $0x4,%esp
  801b5c:	ff 75 f0             	pushl  -0x10(%ebp)
  801b5f:	e8 aa f3 ff ff       	call   800f0e <fd2num>
  801b64:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801b67:	89 41 04             	mov    %eax,0x4(%ecx)
	return 0;
  801b6a:	83 c4 10             	add    $0x10,%esp
  801b6d:	bb 00 00 00 00       	mov    $0x0,%ebx
  801b72:	eb 2e                	jmp    801ba2 <pipe+0x145>
	sys_page_unmap(0, va);
  801b74:	83 ec 08             	sub    $0x8,%esp
  801b77:	56                   	push   %esi
  801b78:	6a 00                	push   $0x0
  801b7a:	e8 0b f2 ff ff       	call   800d8a <sys_page_unmap>
  801b7f:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd1);
  801b82:	83 ec 08             	sub    $0x8,%esp
  801b85:	ff 75 f0             	pushl  -0x10(%ebp)
  801b88:	6a 00                	push   $0x0
  801b8a:	e8 fb f1 ff ff       	call   800d8a <sys_page_unmap>
  801b8f:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd0);
  801b92:	83 ec 08             	sub    $0x8,%esp
  801b95:	ff 75 f4             	pushl  -0xc(%ebp)
  801b98:	6a 00                	push   $0x0
  801b9a:	e8 eb f1 ff ff       	call   800d8a <sys_page_unmap>
  801b9f:	83 c4 10             	add    $0x10,%esp
}
  801ba2:	89 d8                	mov    %ebx,%eax
  801ba4:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801ba7:	5b                   	pop    %ebx
  801ba8:	5e                   	pop    %esi
  801ba9:	5d                   	pop    %ebp
  801baa:	c3                   	ret    

00801bab <pipeisclosed>:
{
  801bab:	f3 0f 1e fb          	endbr32 
  801baf:	55                   	push   %ebp
  801bb0:	89 e5                	mov    %esp,%ebp
  801bb2:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801bb5:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801bb8:	50                   	push   %eax
  801bb9:	ff 75 08             	pushl  0x8(%ebp)
  801bbc:	e8 d2 f3 ff ff       	call   800f93 <fd_lookup>
  801bc1:	83 c4 10             	add    $0x10,%esp
  801bc4:	85 c0                	test   %eax,%eax
  801bc6:	78 18                	js     801be0 <pipeisclosed+0x35>
	p = (struct Pipe*) fd2data(fd);
  801bc8:	83 ec 0c             	sub    $0xc,%esp
  801bcb:	ff 75 f4             	pushl  -0xc(%ebp)
  801bce:	e8 4f f3 ff ff       	call   800f22 <fd2data>
  801bd3:	89 c2                	mov    %eax,%edx
	return _pipeisclosed(fd, p);
  801bd5:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801bd8:	e8 1f fd ff ff       	call   8018fc <_pipeisclosed>
  801bdd:	83 c4 10             	add    $0x10,%esp
}
  801be0:	c9                   	leave  
  801be1:	c3                   	ret    

00801be2 <devcons_close>:
	return tot;
}

static int
devcons_close(struct Fd *fd)
{
  801be2:	f3 0f 1e fb          	endbr32 
	USED(fd);

	return 0;
}
  801be6:	b8 00 00 00 00       	mov    $0x0,%eax
  801beb:	c3                   	ret    

00801bec <devcons_stat>:

static int
devcons_stat(struct Fd *fd, struct Stat *stat)
{
  801bec:	f3 0f 1e fb          	endbr32 
  801bf0:	55                   	push   %ebp
  801bf1:	89 e5                	mov    %esp,%ebp
  801bf3:	83 ec 10             	sub    $0x10,%esp
	strcpy(stat->st_name, "<cons>");
  801bf6:	68 ca 25 80 00       	push   $0x8025ca
  801bfb:	ff 75 0c             	pushl  0xc(%ebp)
  801bfe:	e8 b8 ec ff ff       	call   8008bb <strcpy>
	return 0;
}
  801c03:	b8 00 00 00 00       	mov    $0x0,%eax
  801c08:	c9                   	leave  
  801c09:	c3                   	ret    

00801c0a <devcons_write>:
{
  801c0a:	f3 0f 1e fb          	endbr32 
  801c0e:	55                   	push   %ebp
  801c0f:	89 e5                	mov    %esp,%ebp
  801c11:	57                   	push   %edi
  801c12:	56                   	push   %esi
  801c13:	53                   	push   %ebx
  801c14:	81 ec 8c 00 00 00    	sub    $0x8c,%esp
	for (tot = 0; tot < n; tot += m) {
  801c1a:	be 00 00 00 00       	mov    $0x0,%esi
		memmove(buf, (char*)vbuf + tot, m);
  801c1f:	8d bd 68 ff ff ff    	lea    -0x98(%ebp),%edi
	for (tot = 0; tot < n; tot += m) {
  801c25:	3b 75 10             	cmp    0x10(%ebp),%esi
  801c28:	73 31                	jae    801c5b <devcons_write+0x51>
		m = n - tot;
  801c2a:	8b 5d 10             	mov    0x10(%ebp),%ebx
  801c2d:	29 f3                	sub    %esi,%ebx
  801c2f:	83 fb 7f             	cmp    $0x7f,%ebx
  801c32:	b8 7f 00 00 00       	mov    $0x7f,%eax
  801c37:	0f 47 d8             	cmova  %eax,%ebx
		memmove(buf, (char*)vbuf + tot, m);
  801c3a:	83 ec 04             	sub    $0x4,%esp
  801c3d:	53                   	push   %ebx
  801c3e:	89 f0                	mov    %esi,%eax
  801c40:	03 45 0c             	add    0xc(%ebp),%eax
  801c43:	50                   	push   %eax
  801c44:	57                   	push   %edi
  801c45:	e8 27 ee ff ff       	call   800a71 <memmove>
		sys_cputs(buf, m);
  801c4a:	83 c4 08             	add    $0x8,%esp
  801c4d:	53                   	push   %ebx
  801c4e:	57                   	push   %edi
  801c4f:	e8 d9 ef ff ff       	call   800c2d <sys_cputs>
	for (tot = 0; tot < n; tot += m) {
  801c54:	01 de                	add    %ebx,%esi
  801c56:	83 c4 10             	add    $0x10,%esp
  801c59:	eb ca                	jmp    801c25 <devcons_write+0x1b>
}
  801c5b:	89 f0                	mov    %esi,%eax
  801c5d:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801c60:	5b                   	pop    %ebx
  801c61:	5e                   	pop    %esi
  801c62:	5f                   	pop    %edi
  801c63:	5d                   	pop    %ebp
  801c64:	c3                   	ret    

00801c65 <devcons_read>:
{
  801c65:	f3 0f 1e fb          	endbr32 
  801c69:	55                   	push   %ebp
  801c6a:	89 e5                	mov    %esp,%ebp
  801c6c:	83 ec 08             	sub    $0x8,%esp
  801c6f:	b8 00 00 00 00       	mov    $0x0,%eax
	if (n == 0)
  801c74:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  801c78:	74 21                	je     801c9b <devcons_read+0x36>
	while ((c = sys_cgetc()) == 0)
  801c7a:	e8 d0 ef ff ff       	call   800c4f <sys_cgetc>
  801c7f:	85 c0                	test   %eax,%eax
  801c81:	75 07                	jne    801c8a <devcons_read+0x25>
		sys_yield();
  801c83:	e8 52 f0 ff ff       	call   800cda <sys_yield>
  801c88:	eb f0                	jmp    801c7a <devcons_read+0x15>
	if (c < 0)
  801c8a:	78 0f                	js     801c9b <devcons_read+0x36>
	if (c == 0x04)	// ctl-d is eof
  801c8c:	83 f8 04             	cmp    $0x4,%eax
  801c8f:	74 0c                	je     801c9d <devcons_read+0x38>
	*(char*)vbuf = c;
  801c91:	8b 55 0c             	mov    0xc(%ebp),%edx
  801c94:	88 02                	mov    %al,(%edx)
	return 1;
  801c96:	b8 01 00 00 00       	mov    $0x1,%eax
}
  801c9b:	c9                   	leave  
  801c9c:	c3                   	ret    
		return 0;
  801c9d:	b8 00 00 00 00       	mov    $0x0,%eax
  801ca2:	eb f7                	jmp    801c9b <devcons_read+0x36>

00801ca4 <cputchar>:
{
  801ca4:	f3 0f 1e fb          	endbr32 
  801ca8:	55                   	push   %ebp
  801ca9:	89 e5                	mov    %esp,%ebp
  801cab:	83 ec 20             	sub    $0x20,%esp
	char c = ch;
  801cae:	8b 45 08             	mov    0x8(%ebp),%eax
  801cb1:	88 45 f7             	mov    %al,-0x9(%ebp)
	sys_cputs(&c, 1);
  801cb4:	6a 01                	push   $0x1
  801cb6:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801cb9:	50                   	push   %eax
  801cba:	e8 6e ef ff ff       	call   800c2d <sys_cputs>
}
  801cbf:	83 c4 10             	add    $0x10,%esp
  801cc2:	c9                   	leave  
  801cc3:	c3                   	ret    

00801cc4 <getchar>:
{
  801cc4:	f3 0f 1e fb          	endbr32 
  801cc8:	55                   	push   %ebp
  801cc9:	89 e5                	mov    %esp,%ebp
  801ccb:	83 ec 1c             	sub    $0x1c,%esp
	r = read(0, &c, 1);
  801cce:	6a 01                	push   $0x1
  801cd0:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801cd3:	50                   	push   %eax
  801cd4:	6a 00                	push   $0x0
  801cd6:	e8 3b f5 ff ff       	call   801216 <read>
	if (r < 0)
  801cdb:	83 c4 10             	add    $0x10,%esp
  801cde:	85 c0                	test   %eax,%eax
  801ce0:	78 06                	js     801ce8 <getchar+0x24>
	if (r < 1)
  801ce2:	74 06                	je     801cea <getchar+0x26>
	return c;
  801ce4:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
}
  801ce8:	c9                   	leave  
  801ce9:	c3                   	ret    
		return -E_EOF;
  801cea:	b8 f8 ff ff ff       	mov    $0xfffffff8,%eax
  801cef:	eb f7                	jmp    801ce8 <getchar+0x24>

00801cf1 <iscons>:
{
  801cf1:	f3 0f 1e fb          	endbr32 
  801cf5:	55                   	push   %ebp
  801cf6:	89 e5                	mov    %esp,%ebp
  801cf8:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801cfb:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801cfe:	50                   	push   %eax
  801cff:	ff 75 08             	pushl  0x8(%ebp)
  801d02:	e8 8c f2 ff ff       	call   800f93 <fd_lookup>
  801d07:	83 c4 10             	add    $0x10,%esp
  801d0a:	85 c0                	test   %eax,%eax
  801d0c:	78 11                	js     801d1f <iscons+0x2e>
	return fd->fd_dev_id == devcons.dev_id;
  801d0e:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801d11:	8b 15 40 30 80 00    	mov    0x803040,%edx
  801d17:	39 10                	cmp    %edx,(%eax)
  801d19:	0f 94 c0             	sete   %al
  801d1c:	0f b6 c0             	movzbl %al,%eax
}
  801d1f:	c9                   	leave  
  801d20:	c3                   	ret    

00801d21 <opencons>:
{
  801d21:	f3 0f 1e fb          	endbr32 
  801d25:	55                   	push   %ebp
  801d26:	89 e5                	mov    %esp,%ebp
  801d28:	83 ec 24             	sub    $0x24,%esp
	if ((r = fd_alloc(&fd)) < 0)
  801d2b:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801d2e:	50                   	push   %eax
  801d2f:	e8 09 f2 ff ff       	call   800f3d <fd_alloc>
  801d34:	83 c4 10             	add    $0x10,%esp
  801d37:	85 c0                	test   %eax,%eax
  801d39:	78 3a                	js     801d75 <opencons+0x54>
	if ((r = sys_page_alloc(0, fd, PTE_P|PTE_U|PTE_W|PTE_SHARE)) < 0)
  801d3b:	83 ec 04             	sub    $0x4,%esp
  801d3e:	68 07 04 00 00       	push   $0x407
  801d43:	ff 75 f4             	pushl  -0xc(%ebp)
  801d46:	6a 00                	push   $0x0
  801d48:	e8 b0 ef ff ff       	call   800cfd <sys_page_alloc>
  801d4d:	83 c4 10             	add    $0x10,%esp
  801d50:	85 c0                	test   %eax,%eax
  801d52:	78 21                	js     801d75 <opencons+0x54>
	fd->fd_dev_id = devcons.dev_id;
  801d54:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801d57:	8b 15 40 30 80 00    	mov    0x803040,%edx
  801d5d:	89 10                	mov    %edx,(%eax)
	fd->fd_omode = O_RDWR;
  801d5f:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801d62:	c7 40 08 02 00 00 00 	movl   $0x2,0x8(%eax)
	return fd2num(fd);
  801d69:	83 ec 0c             	sub    $0xc,%esp
  801d6c:	50                   	push   %eax
  801d6d:	e8 9c f1 ff ff       	call   800f0e <fd2num>
  801d72:	83 c4 10             	add    $0x10,%esp
}
  801d75:	c9                   	leave  
  801d76:	c3                   	ret    

00801d77 <ipc_recv>:
//   If 'pg' is null, pass sys_ipc_recv a value that it will understand
//   as meaning "no page".  (Zero is not the right value, since that's
//   a perfectly valid place to map a page.)
int32_t
ipc_recv(envid_t *from_env_store, void *pg, int *perm_store)
{
  801d77:	f3 0f 1e fb          	endbr32 
  801d7b:	55                   	push   %ebp
  801d7c:	89 e5                	mov    %esp,%ebp
  801d7e:	56                   	push   %esi
  801d7f:	53                   	push   %ebx
  801d80:	8b 75 08             	mov    0x8(%ebp),%esi
  801d83:	8b 45 0c             	mov    0xc(%ebp),%eax
  801d86:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	int error;
	if(!pg)pg = (void *)UTOP; // 如果设置为UTOP，这个值其实可以比UTOP大，设置为这个值认为pg无效了，不会进行页面传递【共享页面的设置】，而是只进行值value的传递。
  801d89:	85 c0                	test   %eax,%eax
  801d8b:	ba 00 00 c0 ee       	mov    $0xeec00000,%edx
  801d90:	0f 44 c2             	cmove  %edx,%eax
	if((error = sys_ipc_recv(pg)) < 0){
  801d93:	83 ec 0c             	sub    $0xc,%esp
  801d96:	50                   	push   %eax
  801d97:	e8 2d f1 ff ff       	call   800ec9 <sys_ipc_recv>
  801d9c:	83 c4 10             	add    $0x10,%esp
  801d9f:	85 c0                	test   %eax,%eax
  801da1:	78 3f                	js     801de2 <ipc_recv+0x6b>
		if(from_env_store)*from_env_store = 0;
		if(perm_store)*perm_store = 0;
		return error;
	}

	thisenv = &envs[ENVX(sys_getenvid())]; // for lab4's challenge sfork().
  801da3:	e8 0f ef ff ff       	call   800cb7 <sys_getenvid>
  801da8:	25 ff 03 00 00       	and    $0x3ff,%eax
  801dad:	6b d0 7c             	imul   $0x7c,%eax,%edx
  801db0:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  801db6:	89 15 08 40 80 00    	mov    %edx,0x804008

	if(from_env_store)*from_env_store = thisenv->env_ipc_from;
  801dbc:	85 f6                	test   %esi,%esi
  801dbe:	74 05                	je     801dc5 <ipc_recv+0x4e>
  801dc0:	8b 42 74             	mov    0x74(%edx),%eax
  801dc3:	89 06                	mov    %eax,(%esi)
	if(perm_store)*perm_store = thisenv->env_ipc_perm;
  801dc5:	85 db                	test   %ebx,%ebx
  801dc7:	74 0a                	je     801dd3 <ipc_recv+0x5c>
  801dc9:	a1 08 40 80 00       	mov    0x804008,%eax
  801dce:	8b 40 78             	mov    0x78(%eax),%eax
  801dd1:	89 03                	mov    %eax,(%ebx)
	return thisenv->env_ipc_value;
  801dd3:	a1 08 40 80 00       	mov    0x804008,%eax
  801dd8:	8b 40 70             	mov    0x70(%eax),%eax
}
  801ddb:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801dde:	5b                   	pop    %ebx
  801ddf:	5e                   	pop    %esi
  801de0:	5d                   	pop    %ebp
  801de1:	c3                   	ret    
		if(from_env_store)*from_env_store = 0;
  801de2:	85 f6                	test   %esi,%esi
  801de4:	74 06                	je     801dec <ipc_recv+0x75>
  801de6:	c7 06 00 00 00 00    	movl   $0x0,(%esi)
		if(perm_store)*perm_store = 0;
  801dec:	85 db                	test   %ebx,%ebx
  801dee:	74 eb                	je     801ddb <ipc_recv+0x64>
  801df0:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  801df6:	eb e3                	jmp    801ddb <ipc_recv+0x64>

00801df8 <ipc_send>:
//   Use sys_yield() to be CPU-friendly.
//   If 'pg' is null, pass sys_ipc_try_send a value that it will understand
//   as meaning "no page".  (Zero is not the right value.)
void
ipc_send(envid_t to_env, uint32_t val, void *pg, int perm)
{
  801df8:	f3 0f 1e fb          	endbr32 
  801dfc:	55                   	push   %ebp
  801dfd:	89 e5                	mov    %esp,%ebp
  801dff:	57                   	push   %edi
  801e00:	56                   	push   %esi
  801e01:	53                   	push   %ebx
  801e02:	83 ec 0c             	sub    $0xc,%esp
  801e05:	8b 7d 08             	mov    0x8(%ebp),%edi
  801e08:	8b 75 0c             	mov    0xc(%ebp),%esi
  801e0b:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	if(!pg)pg = (void *)UTOP; // 不会进行页面共享，只会sending message。
  801e0e:	85 db                	test   %ebx,%ebx
  801e10:	b8 00 00 c0 ee       	mov    $0xeec00000,%eax
  801e15:	0f 44 d8             	cmove  %eax,%ebx
	int error;
	// Keep trying until it succeeds.
	while((error = sys_ipc_try_send(to_env, val, pg, perm)) < 0){
  801e18:	ff 75 14             	pushl  0x14(%ebp)
  801e1b:	53                   	push   %ebx
  801e1c:	56                   	push   %esi
  801e1d:	57                   	push   %edi
  801e1e:	e8 7f f0 ff ff       	call   800ea2 <sys_ipc_try_send>
  801e23:	83 c4 10             	add    $0x10,%esp
  801e26:	85 c0                	test   %eax,%eax
  801e28:	79 1e                	jns    801e48 <ipc_send+0x50>
        //如果error是没有接收者，那么就会继续尝试send
		if(error != -E_IPC_NOT_RECV){
  801e2a:	83 f8 f9             	cmp    $0xfffffff9,%eax
  801e2d:	75 07                	jne    801e36 <ipc_send+0x3e>
			panic("sys_ipc_try_send:%e", error);
		}
        //但是不是一味的占用cpu，而是尝试一次就释放CPU，等待再次被调度，才会重新send，寻找receiver。
		sys_yield(); // To be CPU-friendly.
  801e2f:	e8 a6 ee ff ff       	call   800cda <sys_yield>
  801e34:	eb e2                	jmp    801e18 <ipc_send+0x20>
			panic("sys_ipc_try_send:%e", error);
  801e36:	50                   	push   %eax
  801e37:	68 d6 25 80 00       	push   $0x8025d6
  801e3c:	6a 3b                	push   $0x3b
  801e3e:	68 ea 25 80 00       	push   $0x8025ea
  801e43:	e8 b3 e3 ff ff       	call   8001fb <_panic>
	}
}
  801e48:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801e4b:	5b                   	pop    %ebx
  801e4c:	5e                   	pop    %esi
  801e4d:	5f                   	pop    %edi
  801e4e:	5d                   	pop    %ebp
  801e4f:	c3                   	ret    

00801e50 <ipc_find_env>:
// Find the first environment of the given type.  We'll use this to
// find special environments.
// Returns 0 if no such environment exists.
envid_t
ipc_find_env(enum EnvType type)
{
  801e50:	f3 0f 1e fb          	endbr32 
  801e54:	55                   	push   %ebp
  801e55:	89 e5                	mov    %esp,%ebp
  801e57:	8b 4d 08             	mov    0x8(%ebp),%ecx
	int i;
	for (i = 0; i < NENV; i++)
  801e5a:	b8 00 00 00 00       	mov    $0x0,%eax
		if (envs[i].env_type == type)
  801e5f:	6b d0 7c             	imul   $0x7c,%eax,%edx
  801e62:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  801e68:	8b 52 50             	mov    0x50(%edx),%edx
  801e6b:	39 ca                	cmp    %ecx,%edx
  801e6d:	74 11                	je     801e80 <ipc_find_env+0x30>
	for (i = 0; i < NENV; i++)
  801e6f:	83 c0 01             	add    $0x1,%eax
  801e72:	3d 00 04 00 00       	cmp    $0x400,%eax
  801e77:	75 e6                	jne    801e5f <ipc_find_env+0xf>
			return envs[i].env_id;
	return 0;
  801e79:	b8 00 00 00 00       	mov    $0x0,%eax
  801e7e:	eb 0b                	jmp    801e8b <ipc_find_env+0x3b>
			return envs[i].env_id;
  801e80:	6b c0 7c             	imul   $0x7c,%eax,%eax
  801e83:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  801e88:	8b 40 48             	mov    0x48(%eax),%eax
}
  801e8b:	5d                   	pop    %ebp
  801e8c:	c3                   	ret    

00801e8d <pageref>:
#include <inc/lib.h>

int
pageref(void *v)
{
  801e8d:	f3 0f 1e fb          	endbr32 
  801e91:	55                   	push   %ebp
  801e92:	89 e5                	mov    %esp,%ebp
  801e94:	8b 45 08             	mov    0x8(%ebp),%eax
	pte_t pte;

	if (!(uvpd[PDX(v)] & PTE_P))
  801e97:	89 c2                	mov    %eax,%edx
  801e99:	c1 ea 16             	shr    $0x16,%edx
  801e9c:	8b 0c 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%ecx
		return 0;
  801ea3:	ba 00 00 00 00       	mov    $0x0,%edx
	if (!(uvpd[PDX(v)] & PTE_P))
  801ea8:	f6 c1 01             	test   $0x1,%cl
  801eab:	74 1c                	je     801ec9 <pageref+0x3c>
	pte = uvpt[PGNUM(v)];
  801ead:	c1 e8 0c             	shr    $0xc,%eax
  801eb0:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
	if (!(pte & PTE_P))
  801eb7:	a8 01                	test   $0x1,%al
  801eb9:	74 0e                	je     801ec9 <pageref+0x3c>
		return 0;
	return pages[PGNUM(pte)].pp_ref;
  801ebb:	c1 e8 0c             	shr    $0xc,%eax
  801ebe:	0f b7 14 c5 04 00 00 	movzwl -0x10fffffc(,%eax,8),%edx
  801ec5:	ef 
  801ec6:	0f b7 d2             	movzwl %dx,%edx
}
  801ec9:	89 d0                	mov    %edx,%eax
  801ecb:	5d                   	pop    %ebp
  801ecc:	c3                   	ret    
  801ecd:	66 90                	xchg   %ax,%ax
  801ecf:	90                   	nop

00801ed0 <__udivdi3>:
  801ed0:	f3 0f 1e fb          	endbr32 
  801ed4:	55                   	push   %ebp
  801ed5:	57                   	push   %edi
  801ed6:	56                   	push   %esi
  801ed7:	53                   	push   %ebx
  801ed8:	83 ec 1c             	sub    $0x1c,%esp
  801edb:	8b 54 24 3c          	mov    0x3c(%esp),%edx
  801edf:	8b 6c 24 30          	mov    0x30(%esp),%ebp
  801ee3:	8b 74 24 34          	mov    0x34(%esp),%esi
  801ee7:	8b 5c 24 38          	mov    0x38(%esp),%ebx
  801eeb:	85 d2                	test   %edx,%edx
  801eed:	75 19                	jne    801f08 <__udivdi3+0x38>
  801eef:	39 f3                	cmp    %esi,%ebx
  801ef1:	76 4d                	jbe    801f40 <__udivdi3+0x70>
  801ef3:	31 ff                	xor    %edi,%edi
  801ef5:	89 e8                	mov    %ebp,%eax
  801ef7:	89 f2                	mov    %esi,%edx
  801ef9:	f7 f3                	div    %ebx
  801efb:	89 fa                	mov    %edi,%edx
  801efd:	83 c4 1c             	add    $0x1c,%esp
  801f00:	5b                   	pop    %ebx
  801f01:	5e                   	pop    %esi
  801f02:	5f                   	pop    %edi
  801f03:	5d                   	pop    %ebp
  801f04:	c3                   	ret    
  801f05:	8d 76 00             	lea    0x0(%esi),%esi
  801f08:	39 f2                	cmp    %esi,%edx
  801f0a:	76 14                	jbe    801f20 <__udivdi3+0x50>
  801f0c:	31 ff                	xor    %edi,%edi
  801f0e:	31 c0                	xor    %eax,%eax
  801f10:	89 fa                	mov    %edi,%edx
  801f12:	83 c4 1c             	add    $0x1c,%esp
  801f15:	5b                   	pop    %ebx
  801f16:	5e                   	pop    %esi
  801f17:	5f                   	pop    %edi
  801f18:	5d                   	pop    %ebp
  801f19:	c3                   	ret    
  801f1a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  801f20:	0f bd fa             	bsr    %edx,%edi
  801f23:	83 f7 1f             	xor    $0x1f,%edi
  801f26:	75 48                	jne    801f70 <__udivdi3+0xa0>
  801f28:	39 f2                	cmp    %esi,%edx
  801f2a:	72 06                	jb     801f32 <__udivdi3+0x62>
  801f2c:	31 c0                	xor    %eax,%eax
  801f2e:	39 eb                	cmp    %ebp,%ebx
  801f30:	77 de                	ja     801f10 <__udivdi3+0x40>
  801f32:	b8 01 00 00 00       	mov    $0x1,%eax
  801f37:	eb d7                	jmp    801f10 <__udivdi3+0x40>
  801f39:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  801f40:	89 d9                	mov    %ebx,%ecx
  801f42:	85 db                	test   %ebx,%ebx
  801f44:	75 0b                	jne    801f51 <__udivdi3+0x81>
  801f46:	b8 01 00 00 00       	mov    $0x1,%eax
  801f4b:	31 d2                	xor    %edx,%edx
  801f4d:	f7 f3                	div    %ebx
  801f4f:	89 c1                	mov    %eax,%ecx
  801f51:	31 d2                	xor    %edx,%edx
  801f53:	89 f0                	mov    %esi,%eax
  801f55:	f7 f1                	div    %ecx
  801f57:	89 c6                	mov    %eax,%esi
  801f59:	89 e8                	mov    %ebp,%eax
  801f5b:	89 f7                	mov    %esi,%edi
  801f5d:	f7 f1                	div    %ecx
  801f5f:	89 fa                	mov    %edi,%edx
  801f61:	83 c4 1c             	add    $0x1c,%esp
  801f64:	5b                   	pop    %ebx
  801f65:	5e                   	pop    %esi
  801f66:	5f                   	pop    %edi
  801f67:	5d                   	pop    %ebp
  801f68:	c3                   	ret    
  801f69:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  801f70:	89 f9                	mov    %edi,%ecx
  801f72:	b8 20 00 00 00       	mov    $0x20,%eax
  801f77:	29 f8                	sub    %edi,%eax
  801f79:	d3 e2                	shl    %cl,%edx
  801f7b:	89 54 24 08          	mov    %edx,0x8(%esp)
  801f7f:	89 c1                	mov    %eax,%ecx
  801f81:	89 da                	mov    %ebx,%edx
  801f83:	d3 ea                	shr    %cl,%edx
  801f85:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  801f89:	09 d1                	or     %edx,%ecx
  801f8b:	89 f2                	mov    %esi,%edx
  801f8d:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  801f91:	89 f9                	mov    %edi,%ecx
  801f93:	d3 e3                	shl    %cl,%ebx
  801f95:	89 c1                	mov    %eax,%ecx
  801f97:	d3 ea                	shr    %cl,%edx
  801f99:	89 f9                	mov    %edi,%ecx
  801f9b:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
  801f9f:	89 eb                	mov    %ebp,%ebx
  801fa1:	d3 e6                	shl    %cl,%esi
  801fa3:	89 c1                	mov    %eax,%ecx
  801fa5:	d3 eb                	shr    %cl,%ebx
  801fa7:	09 de                	or     %ebx,%esi
  801fa9:	89 f0                	mov    %esi,%eax
  801fab:	f7 74 24 08          	divl   0x8(%esp)
  801faf:	89 d6                	mov    %edx,%esi
  801fb1:	89 c3                	mov    %eax,%ebx
  801fb3:	f7 64 24 0c          	mull   0xc(%esp)
  801fb7:	39 d6                	cmp    %edx,%esi
  801fb9:	72 15                	jb     801fd0 <__udivdi3+0x100>
  801fbb:	89 f9                	mov    %edi,%ecx
  801fbd:	d3 e5                	shl    %cl,%ebp
  801fbf:	39 c5                	cmp    %eax,%ebp
  801fc1:	73 04                	jae    801fc7 <__udivdi3+0xf7>
  801fc3:	39 d6                	cmp    %edx,%esi
  801fc5:	74 09                	je     801fd0 <__udivdi3+0x100>
  801fc7:	89 d8                	mov    %ebx,%eax
  801fc9:	31 ff                	xor    %edi,%edi
  801fcb:	e9 40 ff ff ff       	jmp    801f10 <__udivdi3+0x40>
  801fd0:	8d 43 ff             	lea    -0x1(%ebx),%eax
  801fd3:	31 ff                	xor    %edi,%edi
  801fd5:	e9 36 ff ff ff       	jmp    801f10 <__udivdi3+0x40>
  801fda:	66 90                	xchg   %ax,%ax
  801fdc:	66 90                	xchg   %ax,%ax
  801fde:	66 90                	xchg   %ax,%ax

00801fe0 <__umoddi3>:
  801fe0:	f3 0f 1e fb          	endbr32 
  801fe4:	55                   	push   %ebp
  801fe5:	57                   	push   %edi
  801fe6:	56                   	push   %esi
  801fe7:	53                   	push   %ebx
  801fe8:	83 ec 1c             	sub    $0x1c,%esp
  801feb:	8b 44 24 3c          	mov    0x3c(%esp),%eax
  801fef:	8b 74 24 30          	mov    0x30(%esp),%esi
  801ff3:	8b 5c 24 34          	mov    0x34(%esp),%ebx
  801ff7:	8b 7c 24 38          	mov    0x38(%esp),%edi
  801ffb:	85 c0                	test   %eax,%eax
  801ffd:	75 19                	jne    802018 <__umoddi3+0x38>
  801fff:	39 df                	cmp    %ebx,%edi
  802001:	76 5d                	jbe    802060 <__umoddi3+0x80>
  802003:	89 f0                	mov    %esi,%eax
  802005:	89 da                	mov    %ebx,%edx
  802007:	f7 f7                	div    %edi
  802009:	89 d0                	mov    %edx,%eax
  80200b:	31 d2                	xor    %edx,%edx
  80200d:	83 c4 1c             	add    $0x1c,%esp
  802010:	5b                   	pop    %ebx
  802011:	5e                   	pop    %esi
  802012:	5f                   	pop    %edi
  802013:	5d                   	pop    %ebp
  802014:	c3                   	ret    
  802015:	8d 76 00             	lea    0x0(%esi),%esi
  802018:	89 f2                	mov    %esi,%edx
  80201a:	39 d8                	cmp    %ebx,%eax
  80201c:	76 12                	jbe    802030 <__umoddi3+0x50>
  80201e:	89 f0                	mov    %esi,%eax
  802020:	89 da                	mov    %ebx,%edx
  802022:	83 c4 1c             	add    $0x1c,%esp
  802025:	5b                   	pop    %ebx
  802026:	5e                   	pop    %esi
  802027:	5f                   	pop    %edi
  802028:	5d                   	pop    %ebp
  802029:	c3                   	ret    
  80202a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802030:	0f bd e8             	bsr    %eax,%ebp
  802033:	83 f5 1f             	xor    $0x1f,%ebp
  802036:	75 50                	jne    802088 <__umoddi3+0xa8>
  802038:	39 d8                	cmp    %ebx,%eax
  80203a:	0f 82 e0 00 00 00    	jb     802120 <__umoddi3+0x140>
  802040:	89 d9                	mov    %ebx,%ecx
  802042:	39 f7                	cmp    %esi,%edi
  802044:	0f 86 d6 00 00 00    	jbe    802120 <__umoddi3+0x140>
  80204a:	89 d0                	mov    %edx,%eax
  80204c:	89 ca                	mov    %ecx,%edx
  80204e:	83 c4 1c             	add    $0x1c,%esp
  802051:	5b                   	pop    %ebx
  802052:	5e                   	pop    %esi
  802053:	5f                   	pop    %edi
  802054:	5d                   	pop    %ebp
  802055:	c3                   	ret    
  802056:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80205d:	8d 76 00             	lea    0x0(%esi),%esi
  802060:	89 fd                	mov    %edi,%ebp
  802062:	85 ff                	test   %edi,%edi
  802064:	75 0b                	jne    802071 <__umoddi3+0x91>
  802066:	b8 01 00 00 00       	mov    $0x1,%eax
  80206b:	31 d2                	xor    %edx,%edx
  80206d:	f7 f7                	div    %edi
  80206f:	89 c5                	mov    %eax,%ebp
  802071:	89 d8                	mov    %ebx,%eax
  802073:	31 d2                	xor    %edx,%edx
  802075:	f7 f5                	div    %ebp
  802077:	89 f0                	mov    %esi,%eax
  802079:	f7 f5                	div    %ebp
  80207b:	89 d0                	mov    %edx,%eax
  80207d:	31 d2                	xor    %edx,%edx
  80207f:	eb 8c                	jmp    80200d <__umoddi3+0x2d>
  802081:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802088:	89 e9                	mov    %ebp,%ecx
  80208a:	ba 20 00 00 00       	mov    $0x20,%edx
  80208f:	29 ea                	sub    %ebp,%edx
  802091:	d3 e0                	shl    %cl,%eax
  802093:	89 44 24 08          	mov    %eax,0x8(%esp)
  802097:	89 d1                	mov    %edx,%ecx
  802099:	89 f8                	mov    %edi,%eax
  80209b:	d3 e8                	shr    %cl,%eax
  80209d:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  8020a1:	89 54 24 04          	mov    %edx,0x4(%esp)
  8020a5:	8b 54 24 04          	mov    0x4(%esp),%edx
  8020a9:	09 c1                	or     %eax,%ecx
  8020ab:	89 d8                	mov    %ebx,%eax
  8020ad:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  8020b1:	89 e9                	mov    %ebp,%ecx
  8020b3:	d3 e7                	shl    %cl,%edi
  8020b5:	89 d1                	mov    %edx,%ecx
  8020b7:	d3 e8                	shr    %cl,%eax
  8020b9:	89 e9                	mov    %ebp,%ecx
  8020bb:	89 7c 24 0c          	mov    %edi,0xc(%esp)
  8020bf:	d3 e3                	shl    %cl,%ebx
  8020c1:	89 c7                	mov    %eax,%edi
  8020c3:	89 d1                	mov    %edx,%ecx
  8020c5:	89 f0                	mov    %esi,%eax
  8020c7:	d3 e8                	shr    %cl,%eax
  8020c9:	89 e9                	mov    %ebp,%ecx
  8020cb:	89 fa                	mov    %edi,%edx
  8020cd:	d3 e6                	shl    %cl,%esi
  8020cf:	09 d8                	or     %ebx,%eax
  8020d1:	f7 74 24 08          	divl   0x8(%esp)
  8020d5:	89 d1                	mov    %edx,%ecx
  8020d7:	89 f3                	mov    %esi,%ebx
  8020d9:	f7 64 24 0c          	mull   0xc(%esp)
  8020dd:	89 c6                	mov    %eax,%esi
  8020df:	89 d7                	mov    %edx,%edi
  8020e1:	39 d1                	cmp    %edx,%ecx
  8020e3:	72 06                	jb     8020eb <__umoddi3+0x10b>
  8020e5:	75 10                	jne    8020f7 <__umoddi3+0x117>
  8020e7:	39 c3                	cmp    %eax,%ebx
  8020e9:	73 0c                	jae    8020f7 <__umoddi3+0x117>
  8020eb:	2b 44 24 0c          	sub    0xc(%esp),%eax
  8020ef:	1b 54 24 08          	sbb    0x8(%esp),%edx
  8020f3:	89 d7                	mov    %edx,%edi
  8020f5:	89 c6                	mov    %eax,%esi
  8020f7:	89 ca                	mov    %ecx,%edx
  8020f9:	0f b6 4c 24 04       	movzbl 0x4(%esp),%ecx
  8020fe:	29 f3                	sub    %esi,%ebx
  802100:	19 fa                	sbb    %edi,%edx
  802102:	89 d0                	mov    %edx,%eax
  802104:	d3 e0                	shl    %cl,%eax
  802106:	89 e9                	mov    %ebp,%ecx
  802108:	d3 eb                	shr    %cl,%ebx
  80210a:	d3 ea                	shr    %cl,%edx
  80210c:	09 d8                	or     %ebx,%eax
  80210e:	83 c4 1c             	add    $0x1c,%esp
  802111:	5b                   	pop    %ebx
  802112:	5e                   	pop    %esi
  802113:	5f                   	pop    %edi
  802114:	5d                   	pop    %ebp
  802115:	c3                   	ret    
  802116:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80211d:	8d 76 00             	lea    0x0(%esi),%esi
  802120:	29 fe                	sub    %edi,%esi
  802122:	19 c3                	sbb    %eax,%ebx
  802124:	89 f2                	mov    %esi,%edx
  802126:	89 d9                	mov    %ebx,%ecx
  802128:	e9 1d ff ff ff       	jmp    80204a <__umoddi3+0x6a>
